Skip to content

Nullable method parameters require "?" in PHP 8.4 #228

@shu-yusa

Description

@shu-yusa

Description

From PHP8.4, a parameter that has null as a default value has to be typed as a nullable type: https://www.php.net/manual/en/migration84.deprecated.php
There are several places where method parameters take null as a default value but ? is missing.

Steps to reproduce

Instantiate RSAKey object for example:

bash-3.2$ php -a
Interactive shell

php > require 'vendor/autoload.php';
php > $key = new \SimpleJWT\Keys\RSAKey("{}", 'json');
PHP Deprecated:  SimpleJWT\Keys\Key::toJWK(): Implicitly marking parameter $password as nullable is deprecated, the explicit nullable type must be used instead in /***/simplejwt/src/SimpleJWT/Keys/Key.php on line 237

Deprecated: SimpleJWT\Keys\Key::toJWK(): Implicitly marking parameter $password as nullable is deprecated, the explicit nullable type must be used instead in /***/simplejwt/src/SimpleJWT/Keys/Key.php on line 237
php > 

Expected behaviour

Method is called without deprecation warning.

Environment

  • Version: 1.0.2
  • Server OS: Mac OS, Linux
  • PHP: 8.4
  • Packages: The same one as the master branch composer.json

Backtrace

Insert backtrace where relevant

Additional information

Any other information which you think would be useful in diagnosing the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions