Skip to content

Commit 8331b5e

Browse files
authored
Merge pull request #79 from Ener-Getick/patch-1
Fix an unexpected behaviour with @deprecated tags
2 parents f574de9 + 1be8bc1 commit 8331b5e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/DocBlock/Tags/Deprecated.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ public static function create($body, DescriptionFactory $descriptionFactory = nu
6363

6464
$matches = [];
6565
if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) {
66-
return null;
66+
return new static(
67+
null,
68+
null !== $descriptionFactory ? $descriptionFactory->create($body, $context) : null
69+
);
6770
}
6871

6972
return new static(

tests/unit/DocBlock/Tags/DeprecatedTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,6 @@ public function testFactoryMethodFailsIfVersionIsNotString()
161161
*/
162162
public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex()
163163
{
164-
$this->assertNull(Deprecated::create('dkhf<'));
164+
$this->assertEquals(new Deprecated(), Deprecated::create('dkhf<'));
165165
}
166166
}

0 commit comments

Comments
 (0)