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

Breadcrumb

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

function ConstExprParser::parseArrayItem

1 call to ConstExprParser::parseArrayItem()
ConstExprParser::parseArray in vendor/phpstan/phpdoc-parser/src/Parser/ConstExprParser.php

File

vendor/phpstan/phpdoc-parser/src/Parser/ConstExprParser.php, line 289

Class

ConstExprParser

Namespace

PHPStan\PhpDocParser\Parser

Code

private function parseArrayItem(TokenIterator $tokens) : Ast\ConstExpr\ConstExprArrayItemNode {
    $startLine = $tokens->currentTokenLine();
    $startIndex = $tokens->currentTokenIndex();
    $expr = $this->parse($tokens);
    if ($tokens->tryConsumeTokenType(Lexer::TOKEN_DOUBLE_ARROW)) {
        $key = $expr;
        $value = $this->parse($tokens);
    }
    else {
        $key = null;
        $value = $expr;
    }
    return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstExprArrayItemNode($key, $value), $startLine, $startIndex);
}
RSS feed
Powered by Drupal