function DocParser::addNamespace

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

Sets the default namespaces.

Parameters

array $namespace:

Return value

void

Throws

\RuntimeException

File

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

Class

DocParser
A parser for docblock annotations.

Namespace

Drupal\Component\Annotation\Doctrine

Code

public function addNamespace($namespace) {
    if ($this->imports) {
        throw new \RuntimeException('You must either use addNamespace(), or setImports(), but not both.');
    }
    $this->namespaces[] = $namespace;
}

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