PHP 8.4: fix implicit nullable deprecations

Created on 27 August 2025, 2 months ago

Problem/Motivation

PHP 8.4 introduces a deprecation for implicitly nullable parameters: https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullabl...

Steps to reproduce

Install module on Drupal 10.5 with PHP 8.4. Log shows deprecation notices such as:

PHP Deprecated: Drupal\content_lock\Form\EntityBreakLockForm::buildForm(): Implicitly marking parameter $entity as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/content_lock/src/Form/EntityBreakLockForm.php on line 109

Deprecated: Drupal\content_lock\Form\EntityBreakLockForm::buildForm(): Implicitly marking parameter $entity as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/content_lock/src/Form/EntityBreakLockForm.php on line 109
PHP Deprecated: Drupal\flag_search_api\Plugin\search_api\processor\FlagIndexer::getPropertyDefinitions(): Implicitly marking parameter $datasource as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/flag_search_api/src/Plugin/search_api/processor/FlagIndexer.php on line 120

Proposed resolution

Adjust the nullable parameters to declare them as nullable.

🐛 Bug report
Status

Active

Version

2.4

Component

Code

Created by

🇬🇧United Kingdom johan.gant Belfast, UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024