Skip to content

Commit 932ab66

Browse files
committed
Tokenizer/PHP: fix incorrect condition order
As things were, `$tokens[i]` may not exist and the current condition order would lead to a `PHP Warning: Undefined array key 517 in php_codesniffer/src/Tokenizers/PHP.php on line 2101` notice if the end of the file was reached. Fixed now.
1 parent 67c82d9 commit 932ab66

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Tokenizers/PHP.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2098,7 +2098,7 @@ function return types. We want to keep the parenthesis map clean,
20982098
}
20992099
}
21002100

2101-
if ($tokens[$i] !== '(' && $i !== $numTokens) {
2101+
if ($i !== $numTokens && $tokens[$i] !== '(') {
21022102
$newToken['code'] = T_STRING;
21032103
$newToken['type'] = 'T_STRING';
21042104
}

0 commit comments

Comments
 (0)