Skip to content

Commit c62f459

Browse files
Tomáš Votrubajaapio
authored andcommitted
DocBlock: add removeTag() method
1 parent 14f9edf commit c62f459

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/DocBlock.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,21 @@ private function addTag(Tag $tag)
217217
{
218218
$this->tags[] = $tag;
219219
}
220+
221+
/**
222+
* Remove a tag from this DocBlock.
223+
*
224+
* @param Tag $tag The tag to remove.
225+
*
226+
* @return void
227+
*/
228+
public function removeTag(Tag $tagToRemove)
229+
{
230+
foreach ($this->tags as $key => $tag) {
231+
if ($tag === $tagToRemove) {
232+
unset($this->tags[$key]);
233+
break;
234+
}
235+
}
236+
}
220237
}

0 commit comments

Comments
 (0)