[PHP 8.4] Fix implicitly nullable type declarations
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3519195. -->
Reported by: [kiseleva.t](https://www.drupal.org/user/1945158)
Related to !23
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>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.</p>
<p><a href="https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated">https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated</a></p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<pre>phpcs --standard=SlevomatCodingStandard --sniffs=SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue<br><br><br>FILE: /app/docroot/modules/contrib/aggregator/src/Plugin/Block/AggregatorFeedBlock.php<br>---------------------------------------------------------------------------------------------------<br>FOUND 1 ERROR AFFECTING 1 LINE<br>---------------------------------------------------------------------------------------------------<br> 64 | ERROR | [x] Parameter $logger_factory has null default value, but is not marked as nullable.<br>---------------------------------------------------------------------------------------------------<br>PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY<br>---------------------------------------------------------------------------------------------------<br><br><br>FILE: /app/docroot/modules/contrib/aggregator/tests/src/Functional/migrate_drupal_ui/MigrateUpgradeExecuteTestBase.php<br>----------------------------------------------------------------------------------------------------------------------<br>FOUND 2 ERRORS AFFECTING 1 LINE<br>----------------------------------------------------------------------------------------------------------------------<br> 44 | ERROR | [x] Parameter $available_paths has null default value, but is not marked as nullable.<br> 44 | ERROR | [x] Parameter $missing_paths has null default value, but is not marked as nullable.<br>----------------------------------------------------------------------------------------------------------------------<br>PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY<br>----------------------------------------------------------------------------------------------------------------------<br><br><br>FILE: /app/docroot/modules/contrib/aggregator/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php<br>----------------------------------------------------------------------------------------------<br>FOUND 1 ERROR AFFECTING 1 LINE<br>----------------------------------------------------------------------------------------------<br> 75 | ERROR | [x] Parameter $settings has null default value, but is not marked as nullable.<br>----------------------------------------------------------------------------------------------<br>PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY<br>----------------------------------------------------------------------------------------------<br><br><br>FILE: /app/docroot/modules/contrib/aggregator/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php<br>----------------------------------------------------------------------------------------------<br>FOUND 1 ERROR AFFECTING 1 LINE<br>----------------------------------------------------------------------------------------------<br> 75 | ERROR | [x] Parameter $settings has null default value, but is not marked as nullable.<br>----------------------------------------------------------------------------------------------<br>PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY<br>----------------------------------------------------------------------------------------------</pre>
issue