Skip to content

Commit 4835166

Browse files
authored
Merge pull request #167 from michbeck/master
Fix for generic tag description properly parsing 0
2 parents 90ae750 + 6907dec commit 4835166

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/DocBlock/Tags/Generic.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function create(
5353
Assert::stringNotEmpty($name);
5454
Assert::notNull($descriptionFactory);
5555

56-
$description = $descriptionFactory && $body ? $descriptionFactory->create($body, $context) : null;
56+
$description = $descriptionFactory && $body !== "" ? $descriptionFactory->create($body, $context) : null;
5757

5858
return new static($name, $description);
5959
}

tests/integration/DocblocksWithAnnotationsTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,18 @@ public function testDocblockWithAnnotations(): void
4444

4545
$this->assertCount(3, $docblock->getTags());
4646
}
47+
48+
public function testDocblockWithAnnotationHavingZeroValue(): void
49+
{
50+
$docComment = <<<DOCCOMMENT
51+
/**
52+
* @my-tag 0
53+
*/
54+
DOCCOMMENT;
55+
56+
$factory = DocBlockFactory::createInstance();
57+
$docblock = $factory->create($docComment);
58+
59+
$this->assertSame(0, printf('%i', $docblock->getTagsByName('my-tag')));
60+
}
4761
}

0 commit comments

Comments
 (0)