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
- Use PHP 8.4
- 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
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
Comment #3
liam morlandThe merge request looks good.
Comment #4
dhruv.mittal commentedReviewing it
Comment #5
dhruv.mittal commentedChanges looks good to me.
And Now there are no deprecation warnings so moving it to RTBC.
Thanks !!
Comment #6
liam morlandThe test failures are not caused by this issue.
Comment #7
lmoeniCan this be merged and released?
Comment #9
smustgrave commentedI included this in the majorly updated 4.0.x already but will merge into 3.0.x for those using it.
Comment #11
liam morlandComment #12
liam morlandSorry, I mis-read the code. It does not appear that any change is needed in 2.x.