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)
-----------------------------------------------------------------------------------------------------------------------------------------------
Comments
Comment #2
mahakjain commentedComment #3
mahakjain commentedComment #4
lendudeUpdating 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.
Comment #5
Pooja Ganjage commentedHi,
Creating a patch for this issue, excepted last two remaining points.
Please review the patch.
Thanks.
Comment #6
Pooja Ganjage commentedComment #10
osopolarShould 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.
Comment #12
smustgrave commentedThis 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
Comment #13
quietone commentedThe 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.
Therefore, I am closing this as outdated.
Comment #14
quietone commentedAdding the related issue