Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code Modernization: Fix implicit nullable parameter type deprecation …
…on PHP 8.4. In PHP 8.4, declaring function or method parameters with a default value of `null` is deprecated if the type is not nullable. PHP applications are recommended to ''explicitly'' declare the type as nullable. All type declarations that have a default value of `null`, but without declaring `null` in the type declaration, will emit a deprecation notice: {{{ function test( array $value = null ) {} }}} `Deprecated: Implicitly marking parameter $value as nullable is deprecated, the explicit nullable type must be used instead` **Recommended Changes** Change the implicit nullable type declaration to a nullable type declaration, available since PHP 7.1: {{{#!diff - function test( string $test = null ) {} + function test( ?string $test = null ) {} }}} This commit updates the affected instances in core to use a nullable type declaration. References: * [https://wiki.php.net/rfc/deprecate-implicitly-nullable-types PHP RFC: Deprecate implicitly nullable parameter types] * [https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated PHP.Watch: PHP 8.4: Implicitly nullable parameter declarations deprecated] Follow-up to [28731], [50552], [57337], [57985]. Props ayeshrajans, jrf, audrasjb, jorbin. Fixes #60786. Built from https://develop.svn.wordpress.org/trunk@58009 git-svn-id: http://core.svn.wordpress.org/trunk@57480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Loading branch information
1 parent
593ccf4
commit dd6d4e7
Showing
5 changed files
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters