mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-17 17:47:13 +00:00
Merge pull request #167 from michbeck/master
Fix for generic tag description properly parsing 0
This commit is contained in:
@@ -53,7 +53,7 @@ class Generic extends BaseTag implements Factory\StaticMethod
|
||||
Assert::stringNotEmpty($name);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
$description = $descriptionFactory && $body ? $descriptionFactory->create($body, $context) : null;
|
||||
$description = $descriptionFactory && $body !== "" ? $descriptionFactory->create($body, $context) : null;
|
||||
|
||||
return new static($name, $description);
|
||||
}
|
||||
|
||||
@@ -44,4 +44,18 @@ DOCCOMMENT;
|
||||
|
||||
$this->assertCount(3, $docblock->getTags());
|
||||
}
|
||||
|
||||
public function testDocblockWithAnnotationHavingZeroValue(): void
|
||||
{
|
||||
$docComment = <<<DOCCOMMENT
|
||||
/**
|
||||
* @my-tag 0
|
||||
*/
|
||||
DOCCOMMENT;
|
||||
|
||||
$factory = DocBlockFactory::createInstance();
|
||||
$docblock = $factory->create($docComment);
|
||||
|
||||
$this->assertSame(0, printf('%i', $docblock->getTagsByName('my-tag')));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user