Skip to content

Commit

Permalink
Fix up "Fix mis-identification of 'readonly' keyword"
Browse files Browse the repository at this point in the history
... for changes between PHPCS 3.x vs 4.x.
  • Loading branch information
jrfnl committed Nov 9, 2023
1 parent 674b27a commit 754e75c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Tokenizers/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ protected function tokenize($string)
// Get the next non-whitespace token.
for ($i = ($stackPtr + 1); $i < $numTokens; $i++) {
if (is_array($tokens[$i]) === false
|| isset(Util\Tokens::$emptyTokens[$tokens[$i][0]]) === false
|| isset(Tokens::$emptyTokens[$tokens[$i][0]]) === false
) {
break;
}
Expand Down Expand Up @@ -1284,7 +1284,7 @@ protected function tokenize($string)
$tokenType = $tokens[$i];
}

if (isset(Util\Tokens::$emptyTokens[$tokenType]) === true) {
if (isset(Tokens::$emptyTokens[$tokenType]) === true) {
continue;
}

Expand Down
2 changes: 0 additions & 2 deletions tests/Core/Tokenizer/BackfillReadonlyTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ namespace My\Readonly\Collection;
$var = readonly($a, $b);
/* testReadonlyAsNamespacedFunctionCall */
$var = My\NS\readonly($a, $b);
/* testReadonlyAsNamespaceRelativeFunctionCall */
$var = namespace\ReadOnly($a, $b);
/* testReadonlyAsMethodCall */
$var = $obj->readonly($a, $b);
/* testReadonlyAsNullsafeMethodCall */
Expand Down
6 changes: 1 addition & 5 deletions tests/Core/Tokenizer/BackfillReadonlyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,7 @@ public function dataNotReadonly()
],
[
'/* testReadonlyAsNamespacedFunctionCall */',
'readonly',
],
[
'/* testReadonlyAsNamespaceRelativeFunctionCall */',
'ReadOnly',
'My\NS\readonly',
],
[
'/* testReadonlyAsMethodCall */',
Expand Down

0 comments on commit 754e75c

Please sign in to comment.