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.

Issue fork rdf-3543307

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

hosterholz created an issue. See original summary.

liam morland’s picture

Status: Active » Needs review

The merge request looks good.

dhruv.mittal’s picture

Reviewing it

dhruv.mittal’s picture

Status: Needs review » Reviewed & tested by the community

Changes looks good to me.
And Now there are no deprecation warnings so moving it to RTBC.
Thanks !!

liam morland’s picture

The test failures are not caused by this issue.

lmoeni’s picture

Can this be merged and released?

smustgrave’s picture

Status: Reviewed & tested by the community » Fixed

I included this in the majorly updated 4.0.x already but will merge into 3.0.x for those using it.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

liam morland’s picture

Version: 3.0.x-dev » 2.x-dev
Status: Fixed » Patch (to be ported)
liam morland’s picture

Version: 2.x-dev » 3.0.x-dev
Status: Patch (to be ported) » Fixed

Sorry, I mis-read the code. It does not appear that any change is needed in 2.x.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.