function DocParser::ArrayEntry

Same name in other branches
  1. 9 core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::ArrayEntry()
  2. 8.9.x core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::ArrayEntry()
  3. 10 core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::ArrayEntry()

ArrayEntry ::= Value | KeyValuePair KeyValuePair ::= Key ("=" | ":") PlainValue | Constant Key ::= string | integer | Constant

Return value

array

1 call to DocParser::ArrayEntry()
DocParser::ArrayX in core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php
Array ::= "{" ArrayEntry {"," ArrayEntry}* [","] "}"

File

core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php, line 1145

Class

DocParser
A parser for docblock annotations.

Namespace

Drupal\Component\Annotation\Doctrine

Code

private function ArrayEntry() {
    $peek = $this->lexer
        ->glimpse();
    if (DocLexer::T_EQUALS === $peek['type'] || DocLexer::T_COLON === $peek['type']) {
        if ($this->lexer
            ->isNextToken(DocLexer::T_IDENTIFIER)) {
            $key = $this->Constant();
        }
        else {
            $this->matchAny(array(
                DocLexer::T_INTEGER,
                DocLexer::T_STRING,
            ));
            $key = $this->lexer->token['value'];
        }
        $this->matchAny(array(
            DocLexer::T_EQUALS,
            DocLexer::T_COLON,
        ));
        return array(
            $key,
            $this->PlainValue(),
        );
    }
    return array(
        null,
        $this->Value(),
    );
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.