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

Breadcrumb

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

function DocParser::Values

Same name in this branch
  1. 11.1.x core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::Values()

Values ::= Array | Value {"," Value}* [","]

@psalm-return Arguments

Throws

AnnotationException

ReflectionException

1 call to DocParser::Values()
DocParser::MethodCall in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
MethodCall ::= ["(" [Values] ")"]

File

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

Class

DocParser
A parser for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

private function Values() : array {
    $values = [
        $this->Value(),
    ];
    while ($this->lexer
        ->isNextToken(DocLexer::T_COMMA)) {
        $this->match(DocLexer::T_COMMA);
        if ($this->lexer
            ->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) {
            break;
        }
        $token = $this->lexer->lookahead;
        $value = $this->Value();
        $values[] = $value;
    }
    $namedArguments = [];
    $positionalArguments = [];
    foreach ($values as $k => $value) {
        if (is_object($value) && $value instanceof stdClass) {
            $namedArguments[$value->name] = $value->value;
        }
        else {
            $positionalArguments[$k] = $value;
        }
    }
    return [
        'named_arguments' => $namedArguments,
        'positional_arguments' => $positionalArguments,
    ];
}
RSS feed
Powered by Drupal