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

Breadcrumb

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

function TokenStream::haveTokenInRange

Whether the given position range contains a certain token type.

Parameters

int $startPos Starting position (inclusive):

int $endPos Ending position (exclusive):

int|string $tokenType Token type to look for:

Return value

bool Whether the token occurs in the given range

1 call to TokenStream::haveTokenInRange()
TokenStream::haveTagInRange in vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php

File

vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php, line 188

Class

TokenStream
Provides operations on token streams, for use by pretty printer.

Namespace

PhpParser\Internal

Code

public function haveTokenInRange(int $startPos, int $endPos, $tokenType) : bool {
    $tokens = $this->tokens;
    for ($pos = $startPos; $pos < $endPos; $pos++) {
        if ($tokens[$pos]->is($tokenType)) {
            return true;
        }
    }
    return false;
}

API Navigation

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