You are here

public function DocBlock::appendTag in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock.php \phpDocumentor\Reflection\DocBlock::appendTag()

Appends a tag at the end of the list of tags.

Parameters

Tag $tag The tag to add.:

Return value

Tag The newly added tag.

Throws

\LogicException When the tag belongs to a different DocBlock.

File

vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock.php, line 425

Class

DocBlock
Parses the DocBlock for any structure.

Namespace

phpDocumentor\Reflection

Code

public function appendTag(Tag $tag) {
  if (null === $tag
    ->getDocBlock()) {
    $tag
      ->setDocBlock($this);
  }
  if ($tag
    ->getDocBlock() === $this) {
    $this->tags[] = $tag;
  }
  else {
    throw new \LogicException('This tag belongs to a different DocBlock object.');
  }
  return $tag;
}