DocBlock: add removeTag() method

This commit is contained in:
Tomáš Votruba
2017-11-10 23:53:51 +01:00
committed by Jaap van Otterdijk
parent 14f9edf1ae
commit c62f4592a0
+17
View File
@@ -217,4 +217,21 @@ final class DocBlock
{
$this->tags[] = $tag;
}
/**
* Remove a tag from this DocBlock.
*
* @param Tag $tag The tag to remove.
*
* @return void
*/
public function removeTag(Tag $tagToRemove)
{
foreach ($this->tags as $key => $tag) {
if ($tag === $tagToRemove) {
unset($this->tags[$key]);
break;
}
}
}
}