From 248e5f69dcdee599dffc2d13aa566a14010fbe36 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 14 Nov 2016 19:33:41 +0100 Subject: [PATCH] Fix regex for tag name extraction and restore disabled test --- src/DocBlock/StandardTagFactory.php | 2 +- tests/unit/DocBlock/StandardTagFactoryTest.php | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 0a65646..a438d7d 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -161,7 +161,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/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 0247da0..c9e68c5 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -136,14 +136,10 @@ class StandardTagFactoryTest extends \PHPUnit_Framework_TestCase * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The tag "@user/myuser" does not seem to be wellformed, please check it for errors + * @expectedExceptionMessage The tag "@user[myuser" does not seem to be wellformed, please check it for errors */ public function testExceptionIsThrownIfProvidedTagIsNotWellformed() { - $this->markTestIncomplete( - 'For some reason this test fails; once I have access to a RegEx analyzer I will have to test the regex' - ) - ; $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); $tagFactory->create('@user[myuser'); }