PHP 8.4 compatibility

Created on 27 August 2025, 19 days ago

Problem/Motivation

There are deprecation warnings

FILE: ...ml/docroot/modules/contrib/rdf/tests/src/Functional/CommentAttributesTest.php
-----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------
 262 | WARNING | Implicitly marking a parameter as nullable is deprecated since
     |         | PHP 8.4. Update the type to be explicitly nullable instead. Found
     |         | implicitly nullable parameter: $account.
     |         | (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)
 358 | WARNING | Implicitly marking a parameter as nullable is deprecated since
     |         | PHP 8.4. Update the type to be explicitly nullable instead. Found
     |         | implicitly nullable parameter: $contact.
     |         | (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)
-----------------------------------------------------------------------------------

Steps to reproduce

  1. Use PHP 8.4
  2. Run functional tests and see
    PHP Deprecated:  Drupal\Tests\rdf\Functional\CommentAttributesTest::testBasicCommentRdfaMarkup(): Implicitly marking parameter $account as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/docroot/modules/contrib/rdf/tests/src/Functional/CommentAttributesTest.php on line 262
    
    Deprecated: Drupal\Tests\rdf\Functional\CommentAttributesTest::testBasicCommentRdfaMarkup(): Implicitly marking parameter $account as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/docroot/modules/contrib/rdf/tests/src/Functional/CommentAttributesTest.php on line 262
    PHP Deprecated:  Drupal\Tests\rdf\Functional\CommentAttributesTest::saveComment(): Implicitly marking parameter $contact as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/docroot/modules/contrib/rdf/tests/src/Functional/CommentAttributesTest.php on line 358
    
    Deprecated: Drupal\Tests\rdf\Functional\CommentAttributesTest::saveComment(): Implicitly marking parameter $contact as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/docroot/modules/contrib/rdf/tests/src/Functional/CommentAttributesTest.php on line 358
    

Alternatively scan with phpcompatibility/php-compatibility

composer require --dev --with-all-dependencies \
    phpcompatibility/php-compatibility:10.x@dev \
    dealerdirect/phpcodesniffer-composer-installer:^1.1
php bin/phpcs -p -s \
  --standard=PHPCompatibility \
  --runtime-set testVersion 8.4 \
  --extensions="inc,install,module,php,profile,theme" \
  docroot/modules/contrib/rdf

Proposed resolution

Explicitly mark parameters as nullable.

📌 Task
Status

Active

Version

3.0

Component

Code

Created by

🇩🇪Germany hosterholz

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024