diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 2ed5be5..7b348c7 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -68,7 +68,7 @@ use function trim; final class StandardTagFactory implements TagFactory { /** PCRE regular expression matching a tag name. */ - public const REGEX_TAGNAME = '[\w\-\_\\\\]+'; + public const REGEX_TAGNAME = '[\w\-\_\\\\:]+'; /** * @var string[] An array with a tag as a key, and an @@ -194,7 +194,7 @@ final class StandardTagFactory implements TagFactory private function extractTagParts(string $tagLine) : array { $matches = []; - if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')((?:[\s\(\{:])\s*([^\s].*)|$)/us', $tagLine, $matches)) { + if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')((?:[\s\(\{])\s*([^\s].*)|$)/us', $tagLine, $matches)) { throw new InvalidArgumentException( 'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors' ); diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index cd6b99a..8ca3e57 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -372,9 +372,14 @@ class StandardTagFactoryTest extends TestCase '@tag', ], 'tag specialization' => [ - '@tag:some-spec', - 'tag', - '@tag :some-spec', + '@tag:some-spec body', + 'tag:some-spec', + '@tag:some-spec body', + ], + 'tag specialization(a)' => [ + '@tag:some-spec(body)', + 'tag:some-spec', + '@tag:some-spec (body)', ], 'tag with textual description' => [ '@tag some text',