phpDocumentor\Reflection\DocBlock\Tag::setDocBlock PHP Method

setDocBlock() public method

Sets the docblock this tag belongs to.
public setDocBlock ( DocBlock $docblock = null )
$docblock phpDocumentor\Reflection\DocBlock The new docblock this tag belongs to. Setting NULL removes any association.
    public function setDocBlock(DocBlock $docblock = null)
    {
        $this->docblock = $docblock;
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * Appends a tag at the end of the list of tags.
  *
  * @param Tag $tag The tag to add.
  *
  * @return Tag The newly added tag.
  *
  * @throws \LogicException When the tag belongs to a different DocBlock.
  */
 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;
 }