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

Breadcrumb

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

function ParserAbstract::getAttributesForToken

Get attributes for a single token at the given token position.

Return value

array<string, mixed> Attributes

2 calls to ParserAbstract::getAttributesForToken()
ParserAbstract::createEmptyElemAttributes in vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php
ParserAbstract::doParse in vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php

File

vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php, line 499

Class

ParserAbstract

Namespace

PhpParser

Code

protected function getAttributesForToken(int $tokenPos) : array {
    if ($tokenPos < \count($this->tokens) - 1) {
        return $this->getAttributes($tokenPos, $tokenPos);
    }
    // Get attributes for the sentinel token.
    $token = $this->tokens[$tokenPos];
    return [
        'startLine' => $token->line,
        'startTokenPos' => $tokenPos,
        'startFilePos' => $token->pos,
        'endLine' => $token->line,
        'endTokenPos' => $tokenPos,
        'endFilePos' => $token->pos,
    ];
}

API Navigation

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