From 1be8bc173836c5e34d62ba5ae21307888e8cc81f Mon Sep 17 00:00:00 2001 From: Guilhem N Date: Wed, 13 Jul 2016 22:53:42 +0200 Subject: [PATCH] Fix an unexpected behaviour with @deprecated tags --- src/DocBlock/Tags/Deprecated.php | 5 ++++- tests/unit/DocBlock/Tags/DeprecatedTest.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index d3a0bd7..7c1039f 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -63,7 +63,10 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod $matches = []; if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { - return null; + return new static( + null, + null !== $descriptionFactory ? $descriptionFactory->create($body, $context) : null + ); } return new static( diff --git a/tests/unit/DocBlock/Tags/DeprecatedTest.php b/tests/unit/DocBlock/Tags/DeprecatedTest.php index eca9664..8be9ad7 100644 --- a/tests/unit/DocBlock/Tags/DeprecatedTest.php +++ b/tests/unit/DocBlock/Tags/DeprecatedTest.php @@ -161,6 +161,6 @@ class DeprecatedTest extends \PHPUnit_Framework_TestCase */ public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() { - $this->assertNull(Deprecated::create('dkhf<')); + $this->assertEquals(new Deprecated(), Deprecated::create('dkhf<')); } }