Skip to content

Commit 58836a8

Browse files
committed
ConstantsHelper::is_use_of_global_constant(): do not treat use const alias as global constant usage
This method was incorrectly identifying a constant alias as a global constant. This change aligns this method with how the sibling method in PHPCompatibility behaves (https://github.com/PHPCompatibility/PHPCompatibility/blob/6e10469b0f3827862b37df2ac2b7ec4580ce888f/PHPCompatibility/Helpers/MiscHelper.php#L45).
1 parent 298da73 commit 58836a8

2 files changed

Lines changed: 1 addition & 1 deletion

File tree

WordPress/Helpers/ConstantsHelper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public static function is_use_of_global_constant( File $phpcsFile, $stackPtr ) {
7979
\T_INSTANCEOF => true,
8080
\T_INSTEADOF => true,
8181
\T_GOTO => true,
82+
\T_AS => true,
8283
);
8384
$tokens_to_ignore += Tokens::$ooScopeTokens;
8485
$tokens_to_ignore += Collections::objectOperators();

WordPress/Tests/WP/DiscouragedConstantsUnitTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public function getWarningList() {
4949
60 => 1,
5050
61 => 1,
5151
63 => 1,
52-
64 => 1,
5352
66 => 1,
5453
67 => 1,
5554
71 => 1,

0 commit comments

Comments
 (0)