PhpDocExtractor::getTypes() throws fatal error when type omitted
This commit is contained in:
parent
a48849e58e
commit
54253ecfff
@ -131,8 +131,10 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
|
||||
$types = array();
|
||||
/** @var DocBlock\Tags\Var_|DocBlock\Tags\Return_|DocBlock\Tags\Param $tag */
|
||||
foreach ($docBlock->getTagsByName($tag) as $tag) {
|
||||
if ($tag && null !== $tag->getType()) {
|
||||
$types = array_merge($types, $this->phpDocTypeHelper->getTypes($tag->getType()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($types[0])) {
|
||||
return;
|
||||
|
@ -40,6 +40,11 @@ class PhpDocExtractorTest extends TestCase
|
||||
$this->assertSame($longDescription, $this->extractor->getLongDescription('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property));
|
||||
}
|
||||
|
||||
public function testParamTagTypeIsOmitted()
|
||||
{
|
||||
$this->assertNull($this->extractor->getTypes(OmittedParamTagTypeDocBlock::class, 'omittedType'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider typesWithCustomPrefixesProvider
|
||||
*/
|
||||
@ -176,3 +181,13 @@ class EmptyDocBlock
|
||||
{
|
||||
public $foo;
|
||||
}
|
||||
|
||||
class OmittedParamTagTypeDocBlock
|
||||
{
|
||||
/**
|
||||
* @param $omittedTagType
|
||||
*/
|
||||
public function setOmittedType(array $omittedTagType)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user