diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index a438d7d..786caef 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -113,6 +113,12 @@ final class StandardTagFactory implements TagFactory list($tagName, $tagBody) = $this->extractTagParts($tagLine); + if ($tagBody[0] === '[') { + throw new \InvalidArgumentException( + 'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors' + ); + } + return $this->createTag($tagBody, $tagName, $context); } @@ -161,7 +167,7 @@ final class StandardTagFactory implements TagFactory private function extractTagParts($tagLine) { $matches = array(); - if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s+([^\s].*)|$)/us', $tagLine, $matches)) { + if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\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/integration/DocblocksWithAnnotationsTest.php b/tests/integration/DocblocksWithAnnotationsTest.php new file mode 100644 index 0000000..3c40f4f --- /dev/null +++ b/tests/integration/DocblocksWithAnnotationsTest.php @@ -0,0 +1,35 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +/** + * @coversNothing + */ +final class DocblocksWithAnnotationsTest extends \PHPUnit_Framework_TestCase +{ + public function testDocblockWithAnnotations() + { + $docComment = <<create($docComment); + + $this->assertCount(2, $docblock->getTags()); + } +}