private function DocParser::Constant

Constant ::= integer | string | float | boolean

Return value

mixed

Throws

AnnotationException

2 calls to DocParser::Constant()
DocParser::ArrayEntry in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php
ArrayEntry ::= Value | KeyValuePair KeyValuePair ::= Key ("=" | ":") PlainValue | Constant Key ::= string | integer | Constant
DocParser::PlainValue in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php
PlainValue ::= integer | string | float | boolean | Array | Annotation

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php, line 758

Class

DocParser
A parser for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

private function Constant() {
  $identifier = $this
    ->Identifier();
  if (!defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) {
    list($className, $const) = explode('::', $identifier);
    $alias = false === ($pos = strpos($className, '\\')) ? $className : substr($className, 0, $pos);
    $found = false;
    switch (true) {
      case !empty($this->namespaces):
        foreach ($this->namespaces as $ns) {
          if (class_exists($ns . '\\' . $className) || interface_exists($ns . '\\' . $className)) {
            $className = $ns . '\\' . $className;
            $found = true;
            break;
          }
        }
        break;
      case isset($this->imports[$loweredAlias = strtolower($alias)]):
        $found = true;
        if (false !== $pos) {
          $className = $this->imports[$loweredAlias] . substr($className, $pos);
        }
        else {
          $className = $this->imports[$loweredAlias];
        }
        break;
      default:
        if (isset($this->imports['__NAMESPACE__'])) {
          $ns = $this->imports['__NAMESPACE__'];
          if (class_exists($ns . '\\' . $className) || interface_exists($ns . '\\' . $className)) {
            $className = $ns . '\\' . $className;
            $found = true;
          }
        }
        break;
    }
    if ($found) {
      $identifier = $className . '::' . $const;
    }
  }
  if (!defined($identifier)) {
    throw AnnotationException::semanticalErrorConstants($identifier, $this->context);
  }
  return constant($identifier);
}