function TokenStream::haveTokenImmediatelyAfter
Check whether the position is directly followed by a certain token type.
During this check whitespace and comments are skipped.
Parameters
int $pos Position after which the token should occur:
int|string $expectedTokenType Token to check for:
Return value
bool Whether the expected token was found
2 calls to TokenStream::haveTokenImmediatelyAfter()
- TokenStream::haveBraces in vendor/
nikic/ php-parser/ lib/ PhpParser/ Internal/ TokenStream.php - Whether the given position is immediately surrounded by braces.
- TokenStream::haveParens in vendor/
nikic/ php-parser/ lib/ PhpParser/ Internal/ TokenStream.php - Whether the given position is immediately surrounded by parenthesis.
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ Internal/ TokenStream.php, line 86
Class
- TokenStream
- Provides operations on token streams, for use by pretty printer.
Namespace
PhpParser\InternalCode
public function haveTokenImmediatelyAfter(int $pos, $expectedTokenType) : bool {
$tokens = $this->tokens;
$pos++;
for ($c = \count($tokens); $pos < $c; $pos++) {
$token = $tokens[$pos];
if ($token->is($expectedTokenType)) {
return true;
}
if (!$token->isIgnorable()) {
break;
}
}
return false;
}