Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TokenIterator.php

function TokenIterator::hasTokenImmediatelyAfter

* Check whether the position is directly followed by a certain token type. * * During this check TOKEN_HORIZONTAL_WS and TOKEN_PHPDOC_EOL are skipped

1 call to TokenIterator::hasTokenImmediatelyAfter()
TokenIterator::hasParentheses in vendor/phpstan/phpdoc-parser/src/Parser/TokenIterator.php
* Whether the given position is immediately surrounded by parenthesis.

File

vendor/phpstan/phpdoc-parser/src/Parser/TokenIterator.php, line 348

Class

TokenIterator

Namespace

PHPStan\PhpDocParser\Parser

Code

public function hasTokenImmediatelyAfter(int $pos, int $expectedTokenType) : bool {
    $tokens = $this->tokens;
    $pos++;
    for ($c = count($tokens); $pos < $c; $pos++) {
        $token = $tokens[$pos];
        $type = $token[Lexer::TYPE_OFFSET];
        if ($type === $expectedTokenType) {
            return true;
        }
        if (!in_array($type, [
            Lexer::TOKEN_HORIZONTAL_WS,
            Lexer::TOKEN_PHPDOC_EOL,
        ], true)) {
            break;
        }
    }
    return false;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal