PHP 8.4 | Fix implicitly nullable parameters by jrfnl · Pull Request #5982 · wp-cli/wp-cli

@jrfnl

PHP 8.4 deprecates implicitly nullable parameters, i.e. typed parameters with a `null` default value, which are not explicitly declared as nullable.

As the minimums supported PHP version of this code base is PHP 5.6, adding the nullability operator to the type declaration is not an option at this time.

In this case, however, the parameter is found in the declaration of a `private` method, so removing the type declaration in favour of in-function type checking solves the deprecation without breaking BC (as `private`).

Includes updating the documentation to match (where relevant, i.e. only existing documentation has been touched).

Ref: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types

thelovekesh

@jrfnl jrfnl deleted the feature/php-8.4-fix-implicitly-nullable branch

September 17, 2024 15:53

This was referenced

Sep 17, 2024