Fix PHP 8.4 deprecations: implicitly nullable parameters
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3575388. -->
Reported by: [sebastix](https://www.drupal.org/user/2943731)
>>>
<p>When using the module with PHP8.4, you could get quite some `Deprecated function` messages regarding the Implicitly nullable parameter declarations deprecated introduced in the 8.4 release of PHP. See <a href="https://www.php.net/manual/en/migration84.deprecated.php">https://www.php.net/manual/en/migration84.deprecated.php</a>.</p>
<p>Code analysis with PHPstan <code>vendor/bin/phpstan analyze web/modules/contrib/danse</code>:</p>
<pre> ------ ----------------------------------------------------------------------------------------------------- <br> Line modules/content/src/Plugin/Danse/Content.php <br> ------ ----------------------------------------------------------------------------------------------------- <br> 468 Deprecated in PHP 8.4: Parameter #4 $bundle (string) is implicitly nullable via default value null. <br> 723 Deprecated in PHP 8.4: Parameter #4 $values (array) is implicitly nullable via default value null. <br> ------ ----------------------------------------------------------------------------------------------------- <br><br> ------ --------------------------------------------------------------------------------------------------------------------------- <br> Line modules/content/src/Plugin/Danse/ContentSettingsTrait.php (in context of class Drupal\danse_content\Plugin\Danse\Content) <br> ------ --------------------------------------------------------------------------------------------------------------------------- <br> 29 Deprecated in PHP 8.4: Parameter #2 $bundle (string) is implicitly nullable via default value null. <br> ------ --------------------------------------------------------------------------------------------------------------------------- <br><br> ------ ----------------------------------------------------------------------------------------------------------------------------- <br> Line modules/eca/src/Event/BaseEvent.php <br> ------ ----------------------------------------------------------------------------------------------------------------------------- <br> 37 Deprecated in PHP 8.4: Parameter #2 $payload (Drupal\danse\PayloadInterface) is implicitly nullable via default value null. <br> ------ ----------------------------------------------------------------------------------------------------- <br> Line modules/content/src/Plugin/Danse/Content.php <br> ------ ----------------------------------------------------------------------------------------------------- <br> 468 Deprecated in PHP 8.4: Parameter #4 $bundle (string) is implicitly nullable via default value null. <br> 723 Deprecated in PHP 8.4: Parameter #4 $values (array) is implicitly nullable via default value null. <br> ------ ----------------------------------------------------------------------------------------------------- <br><br> ------ --------------------------------------------------------------------------------------------------------------------------- <br> Line modules/content/src/Plugin/Danse/ContentSettingsTrait.php (in context of class Drupal\danse_content\Plugin\Danse\Content) <br> ------ --------------------------------------------------------------------------------------------------------------------------- <br> 29 Deprecated in PHP 8.4: Parameter #2 $bundle (string) is implicitly nullable via default value null. <br> ------ --------------------------------------------------------------------------------------------------------------------------- <br><br> ------ ----------------------------------------------------------------------------------------------------------------------------- <br> Line modules/eca/src/Event/BaseEvent.php <br> ------ ----------------------------------------------------------------------------------------------------------------------------- <br> 37 Deprecated in PHP 8.4: Parameter #2 $payload (Drupal\danse\PayloadInterface) is implicitly nullable via default value null. <br> ------ ----------------------------------------------------------------------------------------------------------------------------- <br><br> ------ ------------------------------------------------------------------------------------------------------------------------------------ <br> Line modules/generic/src/Plugin/Action/DanseEventArbitrary.php <br> ------ ------------------------------------------------------------------------------------------------------------------------------------ <br> 24 Deprecated in PHP 8.4: Parameter #2 $account (Drupal\Core\Session\AccountInterface) is implicitly nullable via default value null. <br> ------ ------------------------------------------------------------------------------------------------------------------------------------ <br><br> ------ ------------------------------------------------------------------------------------------------------------------------------------ <br> Line modules/generic/src/Plugin/Action/DanseEventContentEntity.php <br> ------ ------------------------------------------------------------------------------------------------------------------------------------ <br> 24 Deprecated in PHP 8.4: Parameter #2 $account (Drupal\Core\Session\AccountInterface) is implicitly nullable via default value null. <br> ------ ------------------------------------------------------------------------------------------------------------------------------------ <br><br> ------ --------------------------------------------------------------------------------------------------- <br> Line src/Cron.php <br> ------ --------------------------------------------------------------------------------------------------- <br> 63 Deprecated in PHP 8.4: Parameter #1 $batch (array) is implicitly nullable via default value null. <br> ------ --------------------------------------------------------------------------------------------------- <br><br> ------ ------------------------------------------------------------------------------------------------------------------------------------ <br> Line src/Entity/EventAccess.php <br> ------ ------------------------------------------------------------------------------------------------------------------------------------ <br> 48 Deprecated in PHP 8.4: Parameter #3 $account (Drupal\Core\Session\AccountInterface) is implicitly nullable via default value null. <br> ------ ------------------------------------------------------------------------------------------------------------------------------------ <br><br> ------ ---------------------------------------------------------------------------------------------------------------------- <br> Line src/Form/Subscriptions.php <br> ------ ---------------------------------------------------------------------------------------------------------------------- <br> 65 Deprecated in PHP 8.4: Parameter #3 $user (Drupal\user\UserInterface) is implicitly nullable via default value null. <br> ------ ---------------------------------------------------------------------------------------------------------------------- <br><br> ------ ---------------------------------------------------------------------------------------------------------------------- <br> Line src/Service.php <br> ------ ---------------------------------------------------------------------------------------------------------------------- <br> 122 Deprecated in PHP 8.4: Parameter #1 $user (Drupal\user\UserInterface) is implicitly nullable via default value null. <br> ------ ---------------------------------------------------------------------------------------------------------------------- </pre>
issue