FIx crashes when tag doesn't have a type
parent
33211c68ca
commit
c2ae7cd022
|
@ -585,7 +585,11 @@ class DefinitionResolver
|
||||||
if ($node instanceof Node\Param) {
|
if ($node instanceof Node\Param) {
|
||||||
// Parameters
|
// Parameters
|
||||||
$docBlock = $node->getAttribute('parentNode')->getAttribute('docBlock');
|
$docBlock = $node->getAttribute('parentNode')->getAttribute('docBlock');
|
||||||
if ($docBlock !== null && count($paramTags = $docBlock->getTagsByName('param')) > 0) {
|
if (
|
||||||
|
$docBlock !== null
|
||||||
|
&& !empty($paramTags = $docBlock->getTagsByName('param'))
|
||||||
|
&& $paramTags[0]->getType() !== null
|
||||||
|
) {
|
||||||
// Use @param tag
|
// Use @param tag
|
||||||
return $paramTags[0]->getType();
|
return $paramTags[0]->getType();
|
||||||
}
|
}
|
||||||
|
@ -607,7 +611,11 @@ class DefinitionResolver
|
||||||
if ($node instanceof Node\FunctionLike) {
|
if ($node instanceof Node\FunctionLike) {
|
||||||
// Functions/methods
|
// Functions/methods
|
||||||
$docBlock = $node->getAttribute('docBlock');
|
$docBlock = $node->getAttribute('docBlock');
|
||||||
if ($docBlock !== null && count($returnTags = $docBlock->getTagsByName('return')) > 0) {
|
if (
|
||||||
|
$docBlock !== null
|
||||||
|
&& !empty($returnTags = $docBlock->getTagsByName('return'))
|
||||||
|
&& $returnTags[0]->getType() !== null
|
||||||
|
) {
|
||||||
// Use @return tag
|
// Use @return tag
|
||||||
return $returnTags[0]->getType();
|
return $returnTags[0]->getType();
|
||||||
}
|
}
|
||||||
|
@ -625,7 +633,11 @@ class DefinitionResolver
|
||||||
if ($node instanceof Node\Stmt\PropertyProperty || $node instanceof Node\Const_) {
|
if ($node instanceof Node\Stmt\PropertyProperty || $node instanceof Node\Const_) {
|
||||||
// Property or constant
|
// Property or constant
|
||||||
$docBlock = $node->getAttribute('parentNode')->getAttribute('docBlock');
|
$docBlock = $node->getAttribute('parentNode')->getAttribute('docBlock');
|
||||||
if ($docBlock !== null && count($varTags = $docBlock->getTagsByName('var')) > 0) {
|
if (
|
||||||
|
$docBlock !== null
|
||||||
|
&& !empty($varTags = $docBlock->getTagsByName('var'))
|
||||||
|
&& $varTags[0]->getType()
|
||||||
|
) {
|
||||||
// Use @var tag
|
// Use @var tag
|
||||||
return $varTags[0]->getType();
|
return $varTags[0]->getType();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue