You are here

private function DocParser::PlainValue in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::PlainValue()

PlainValue ::= integer | string | float | boolean | Array | Annotation

Return value

mixed

3 calls to DocParser::PlainValue()
DocParser::ArrayEntry in core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php
ArrayEntry ::= Value | KeyValuePair KeyValuePair ::= Key ("=" | ":") PlainValue | Constant Key ::= string | integer | Constant
DocParser::FieldAssignment in core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php
FieldAssignment ::= FieldName "=" PlainValue FieldName ::= identifier
DocParser::Value in core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php
Value ::= PlainValue | FieldAssignment

File

core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php, line 1004
This class is a near-copy of Doctrine\Common\Annotations\DocParser, which is part of the Doctrine project: <http://www.doctrine-project.org>. It was copied from version 1.2.7.

Class

DocParser
A parser for docblock annotations.

Namespace

Drupal\Component\Annotation\Doctrine

Code

private function PlainValue() {
  if ($this->lexer
    ->isNextToken(DocLexer::T_OPEN_CURLY_BRACES)) {
    return $this
      ->Arrayx();
  }
  if ($this->lexer
    ->isNextToken(DocLexer::T_AT)) {
    return $this
      ->Annotation();
  }
  if ($this->lexer
    ->isNextToken(DocLexer::T_IDENTIFIER)) {
    return $this
      ->Constant();
  }
  switch ($this->lexer->lookahead['type']) {
    case DocLexer::T_STRING:
      $this
        ->match(DocLexer::T_STRING);
      return $this->lexer->token['value'];
    case DocLexer::T_INTEGER:
      $this
        ->match(DocLexer::T_INTEGER);
      return (int) $this->lexer->token['value'];
    case DocLexer::T_FLOAT:
      $this
        ->match(DocLexer::T_FLOAT);
      return (double) $this->lexer->token['value'];
    case DocLexer::T_TRUE:
      $this
        ->match(DocLexer::T_TRUE);
      return true;
    case DocLexer::T_FALSE:
      $this
        ->match(DocLexer::T_FALSE);
      return false;
    case DocLexer::T_NULL:
      $this
        ->match(DocLexer::T_NULL);
      return null;
    default:
      $this
        ->syntaxError('PlainValue');
  }
}