Merge pull request #167 from michbeck/master

Fix for generic tag description properly parsing 0
This commit is contained in:
Jaap van Otterdijk
2019-04-30 20:01:57 +02:00
committed by GitHub
2 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ class Generic extends BaseTag implements Factory\StaticMethod
Assert::stringNotEmpty($name); Assert::stringNotEmpty($name);
Assert::notNull($descriptionFactory); Assert::notNull($descriptionFactory);
$description = $descriptionFactory && $body ? $descriptionFactory->create($body, $context) : null; $description = $descriptionFactory && $body !== "" ? $descriptionFactory->create($body, $context) : null;
return new static($name, $description); return new static($name, $description);
} }
@@ -44,4 +44,18 @@ DOCCOMMENT;
$this->assertCount(3, $docblock->getTags()); $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')));
}
} }