Skip to content

Commit 9782862

Browse files
committed
Fix 2 ?
1 parent 2d8c6de commit 9782862

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Tokenizers/PHP.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,16 +1468,18 @@ protected function tokenize($string)
14681468
$newToken['type'] = 'T_ATTRIBUTE';
14691469
$newToken['content'] = '#[';
14701470
$finalTokens[$newStackPtr] = $newToken;
1471+
$newStackPtr++;
14711472

1472-
$tokens[$bracketCloser] = [];
1473-
$tokens[$bracketCloser][0] = T_ATTRIBUTE_END;
1474-
$tokens[$bracketCloser][1] = ']';
1473+
if ($bracketCloser !== null) {
1474+
$tokens[$bracketCloser] = [];
1475+
$tokens[$bracketCloser][0] = T_ATTRIBUTE_END;
1476+
$tokens[$bracketCloser][1] = ']';
14751477

1476-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
1477-
echo "\t\t* token $bracketCloser changed from T_CLOSE_SQUARE_BRACKET to T_ATTRIBUTE_END".PHP_EOL;
1478+
if (PHP_CODESNIFFER_VERBOSITY > 1) {
1479+
echo "\t\t* token $bracketCloser changed from T_CLOSE_SQUARE_BRACKET to T_ATTRIBUTE_END".PHP_EOL;
1480+
}
14781481
}
14791482

1480-
$newStackPtr++;
14811483
continue;
14821484
}//end if
14831485

0 commit comments

Comments
 (0)