WordPress/wp-includes/l10n
Sergey Biryukov dd6d4e74c1 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
2024-04-15 20:03:09 +00:00
..
class-wp-translation-controller.php Code Modernization: Fix implicit nullable parameter type deprecation on PHP 8.4. 2024-04-15 20:03:09 +00:00
class-wp-translation-file-mo.php I18N: Cast magic MO marker number to integer. 2024-03-04 15:54:10 +00:00
class-wp-translation-file-php.php I18N: Improve singular lookup of pluralized strings. 2024-02-01 11:45:16 +00:00
class-wp-translation-file.php Code Modernization: Fix implicit nullable parameter type deprecation on PHP 8.4. 2024-04-15 20:03:09 +00:00
class-wp-translations.php I18N: Improve singular lookup of pluralized strings. 2024-02-01 11:45:16 +00:00