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

Breadcrumb

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

function TokenParser::next

Gets the next non whitespace and non comment token.

Parameters

bool $docCommentIsComment If TRUE then a doc comment is considered a comment and skipped.: If FALSE then only whitespace and normal comments are skipped.

Return value

mixed[]|string|null The token if exists, null otherwise.

3 calls to TokenParser::next()
TokenParser::parseNamespace in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php
Gets the namespace.
TokenParser::parseUseStatement in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php
Parses a single use statement.
TokenParser::parseUseStatements in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php
Gets all use statements.

File

vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php, line 73

Class

TokenParser
Parses a file for namespaces/use/class declarations.

Namespace

Doctrine\Common\Annotations

Code

public function next(bool $docCommentIsComment = true) {
    for ($i = $this->pointer; $i < $this->numTokens; $i++) {
        $this->pointer++;
        if ($this->tokens[$i][0] === T_WHITESPACE || $this->tokens[$i][0] === T_COMMENT || $docCommentIsComment && $this->tokens[$i][0] === T_DOC_COMMENT) {
            continue;
        }
        return $this->tokens[$i];
    }
    return null;
}

API Navigation

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