Skip to content

Commit 4aada1f

Browse files
Roberto Espinozajaapio
authored andcommitted
Check tag body has a value before trying to access it as an string array
1 parent 183824d commit 4aada1f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/DocBlock/StandardTagFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function create($tagLine, TypeContext $context = null)
113113

114114
list($tagName, $tagBody) = $this->extractTagParts($tagLine);
115115

116-
if ($tagBody[0] === '[') {
116+
if ($tagBody !== '' && $tagBody[0] === '[') {
117117
throw new \InvalidArgumentException(
118118
'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors'
119119
);

tests/integration/DocblocksWithAnnotationsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ public function testDocblockWithAnnotations()
2323
/**
2424
* @var \DateTime[]
2525
* @Groups({"a", "b"})
26+
* @ORM\Entity
2627
*/
2728
DOCCOMMENT;
2829

2930

3031
$factory = DocBlockFactory::createInstance();
3132
$docblock = $factory->create($docComment);
3233

33-
$this->assertCount(2, $docblock->getTags());
34+
$this->assertCount(3, $docblock->getTags());
3435
}
3536
}

0 commit comments

Comments
 (0)