Getting some errors and warnings while running the PHPCS report for PHP version 7.3.

FILE: core/lib/Drupal/Core/Entity/Query/Null/QueryFactory.php
-----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------
 3 | ERROR | 'null' is a reserved keyword as of PHP version 7.0 and should not be used to name a class, interface or trait or as part of a
   |       | namespace (T_NAMESPACE) (PHPCompatibility.Keywords.ForbiddenNamesAsDeclared.nullFound)
-----------------------------------------------------------------------------------------------------------------------------------------------


FILE: core/lib/Drupal/Core/Entity/Query/Null/Query.php
-----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------
 3 | ERROR | 'null' is a reserved keyword as of PHP version 7.0 and should not be used to name a class, interface or trait or as part of a
   |       | namespace (T_NAMESPACE) (PHPCompatibility.Keywords.ForbiddenNamesAsDeclared.nullFound)
-----------------------------------------------------------------------------------------------------------------------------------------------
FILE: core/lib/Drupal/Core/Entity/Query/Null/Condition.php
-----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------
 3 | ERROR | 'null' is a reserved keyword as of PHP version 7.0 and should not be used to name a class, interface or trait or as part of a
   |       | namespace (T_NAMESPACE) (PHPCompatibility.Keywords.ForbiddenNamesAsDeclared.nullFound)
-----------------------------------------------------------------------------------------------------------------------------------------------

FILE: core/lib/Drupal/Core/Template/TwigExtension.php
-----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------
 667 | WARNING | Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a
     |         | parameter, but will instead provide the current value. The parameter "$element" was used, and possibly changed (by
     |         | reference), on line 661. (PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection)
-----------------------------------------------------------------------------------------------------------------------------------------------

FILE: core/lib/Drupal/Core/Form/FormBuilder.php
-----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------------
 464 | WARNING | Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a
     |         | parameter, but will instead provide the current value. The parameter "$form_state" was used, and possibly changed (by
     |         | reference), on line 462. (PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection)
-----------------------------------------------------------------------------------------------------------------------------------------------
CommentFileSizeAuthor
#5 3170886-5.patch3.49 KBPooja Ganjage

Comments

mahakjain created an issue. See original summary.

mahakjain’s picture

Issue summary: View changes
mahakjain’s picture

Title: 'null' is a reserved keyword and unc_get_args(), no longer report the original value » 'null' is a reserved keyword and func_get_args(), no longer report the original value
lendude’s picture

Version: 8.8.x-dev » 9.2.x-dev
Category: Bug report » Task

Updating this would be a task I think. I've set the core version to the version of Drupal core currently targeted for these types of changes.

Pooja Ganjage’s picture

StatusFileSize
new3.49 KB

Hi,

Creating a patch for this issue, excepted last two remaining points.

Please review the patch.

Thanks.

Pooja Ganjage’s picture

Status: Active » Needs review

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

osopolar’s picture

Should this issue be tagged with "PHP 7.4", "PHP 8.0", "PHP 8.1" etc.? It would be nice to get rid of these errors in PHPCS report, because each error in PHPCS report requires to check if it may causes problems for php version upgrade.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative, +Needs issue summary update

This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

This needs to be rechecked for php8.1

quietone’s picture

Status: Needs work » Closed (outdated)
Issue tags: -Needs issue summary update

The errors reported are from the sniff, PHPCompatibility.Keywords.ForbiddenNamesAsDeclared.nullFound, which is not used by Drupal core. The sniffs used by core are in core/phpcs.xml.dist.

I searched and found, #3051052: Null reserved word as the namespace part. In the last comment eelkeblok provides links that shows this is no longer a problem.

Actually, it seems this message is a false positive from PHP compatibility checker. See https://wiki.php.net/rfc/namespaced_names_as_token and https://github.com/PHPCompatibility/PHPCompatibility/pull/1402.

Therefore, I am closing this as outdated.

quietone’s picture

Adding the related issue