Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

PHP 8.4 | Fix implicitly nullable parameters#5982

Merged
swissspidy merged 1 commit into
wp-cli:mainwp-cli/wp-cli:mainfrom
jrfnl:feature/php-8.4-fix-implicitly-nullablejrfnl/wp-cli:feature/php-8.4-fix-implicitly-nullableCopy head branch name to clipboard
Sep 17, 2024
Merged

PHP 8.4 | Fix implicitly nullable parameters#5982
swissspidy merged 1 commit into
wp-cli:mainwp-cli/wp-cli:mainfrom
jrfnl:feature/php-8.4-fix-implicitly-nullablejrfnl/wp-cli:feature/php-8.4-fix-implicitly-nullableCopy head branch name to clipboard

Conversation

@jrfnl

@jrfnl jrfnl commented Sep 16, 2024

Copy link
Copy Markdown
Contributor

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

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
@jrfnl jrfnl requested a review from a team as a code owner September 16, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.