From 9b08619fbd98e412d54b6838430bb4e5fe382bae Mon Sep 17 00:00:00 2001 From: Jeppe Knockaert Date: Tue, 23 Oct 2018 15:38:27 +0200 Subject: [PATCH] Allow deleting tags in DocBlocks --- src/Barryvdh/Reflection/DocBlock.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Barryvdh/Reflection/DocBlock.php b/src/Barryvdh/Reflection/DocBlock.php index 434cae6..9296060 100644 --- a/src/Barryvdh/Reflection/DocBlock.php +++ b/src/Barryvdh/Reflection/DocBlock.php @@ -439,6 +439,23 @@ class DocBlock implements \Reflector return $tag; } + /** + * Deletes a tag from the list of tags. + * + * @param Tag $tag The tag to be deleted. + * + * @return bool True if the tag was deleted. + */ + public function deleteTag(Tag $tag) + { + if (($key = array_search($tag, $this->tags)) !== false) { + unset($this->tags[$key]); + + return true; + } + + return false; + } /** * Builds a string representation of this object.