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
Namespace
PhpParserCode
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,
];
}