Problem/Motivation
ppl
In PHP 8.4, declaring functions/methods with parameters containing null as a default value, but without null as one of the types (either as a nullable syntax or as a Union type with null) is deprecated.
https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullabl...
Steps to reproduce
Run Drupal in PHP 8.4.
Proposed resolution
Update all instances of such declarations to use Union types or nullable types.
This is a rather big set of changes. To replicate the results:
cd core
../vendor/bin/phpcbf --standard=SlevomatCodingStandard --sniffs=SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue lib modules themes profiles tests
orphp-cs-fixer fix . --rules nullable_type_declaration_for_default_null_value
Add SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue
sniffer to prevent new issues
Remaining tasks
- decide on merge strategy (all at once after fixing manual set or split per module/system)
- patch/commit
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
Several fixes in Drupal core to fix the deprecation notices due on implicitly nullable function/method parameter declarations.
See: