mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Check tag body has a value before trying to access it as an string array
This commit is contained in:
committed by
Jaap van Otterdijk
parent
3c8d2425b5
commit
a8d791f8c9
@@ -113,7 +113,7 @@ final class StandardTagFactory implements TagFactory
|
|||||||
|
|
||||||
list($tagName, $tagBody) = $this->extractTagParts($tagLine);
|
list($tagName, $tagBody) = $this->extractTagParts($tagLine);
|
||||||
|
|
||||||
if ($tagBody[0] === '[') {
|
if ($tagBody !== '' && $tagBody[0] === '[') {
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException(
|
||||||
'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors'
|
'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ final class DocblocksWithAnnotationsTest extends \PHPUnit_Framework_TestCase
|
|||||||
/**
|
/**
|
||||||
* @var \DateTime[]
|
* @var \DateTime[]
|
||||||
* @Groups({"a", "b"})
|
* @Groups({"a", "b"})
|
||||||
|
* @ORM\Entity
|
||||||
*/
|
*/
|
||||||
DOCCOMMENT;
|
DOCCOMMENT;
|
||||||
|
|
||||||
@@ -30,6 +31,6 @@ DOCCOMMENT;
|
|||||||
$factory = DocBlockFactory::createInstance();
|
$factory = DocBlockFactory::createInstance();
|
||||||
$docblock = $factory->create($docComment);
|
$docblock = $factory->create($docComment);
|
||||||
|
|
||||||
$this->assertCount(2, $docblock->getTags());
|
$this->assertCount(3, $docblock->getTags());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user