diff --git a/src/Tokenizers/PHP.php b/src/Tokenizers/PHP.php index b5a7f84ada..f85c32125d 100644 --- a/src/Tokenizers/PHP.php +++ b/src/Tokenizers/PHP.php @@ -2255,6 +2255,9 @@ protected function tokenize($string) for ($i = ($stackPtr - 1); $i >= 0; $i--) { if (is_array($tokens[$i]) === true) { $tokenType = $tokens[$i][0]; + } else if ($tokens[$i] === null) { + // Ignore skipped tokens. + continue; } else { $tokenType = $tokens[$i]; } @@ -2268,7 +2271,7 @@ protected function tokenize($string) } if ($prevNonEmpty === null - && @isset(Tokens::$emptyTokens[$tokenType]) === false + && isset(Tokens::$emptyTokens[$tokenType]) === false ) { // Found the previous non-empty token. if ($tokenType === ':' || $tokenType === ',' || $tokenType === T_ATTRIBUTE_END) { @@ -2287,8 +2290,8 @@ protected function tokenize($string) if ($tokenType === T_FUNCTION || $tokenType === T_FN - || @isset(Tokens::$methodPrefixes[$tokenType]) === true - || @isset(Tokens::$scopeModifiers[$tokenType]) === true + || isset(Tokens::$methodPrefixes[$tokenType]) === true + || isset(Tokens::$scopeModifiers[$tokenType]) === true || $tokenType === T_VAR || $tokenType === T_READONLY ) { @@ -2311,7 +2314,7 @@ protected function tokenize($string) break; } - if (@isset(Tokens::$emptyTokens[$tokenType]) === false) { + if (isset(Tokens::$emptyTokens[$tokenType]) === false) { $lastSeenNonEmpty = $tokenType; } }//end for