Skip to content

Commit 14788ab

Browse files
committed
Merge branch 'feature/php-8-fix-array-access-on-type-null' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents 6cc3301 + ec236a5 commit 14788ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Tokenizers/PHP.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,8 @@ function return types. We want to keep the parenthesis map clean,
14411441
&& $token[0] === T_STRING
14421442
&& isset($tokens[($stackPtr + 1)]) === true
14431443
&& $tokens[($stackPtr + 1)] === ':'
1444-
&& $tokens[($stackPtr - 1)][0] !== T_PAAMAYIM_NEKUDOTAYIM
1444+
&& (is_array($tokens[($stackPtr - 1)]) === false
1445+
|| $tokens[($stackPtr - 1)][0] !== T_PAAMAYIM_NEKUDOTAYIM)
14451446
) {
14461447
$stopTokens = [
14471448
T_CASE => true,

0 commit comments

Comments
 (0)