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

Breadcrumb

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

function DocParser::ArrayEntry

Same name in this branch
  1. 11.1.x 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

@phpstan-return array{mixed, mixed}

Throws

AnnotationException

ReflectionException

1 call to DocParser::ArrayEntry()
DocParser::Arrayx in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
Array ::= "{" ArrayEntry {"," ArrayEntry}* [","] "}"

File

vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php, line 1374

Class

DocParser
A parser for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

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