1
0
Fork 0

Fix using @var tag for variables

pull/165/head
Felix Becker 2016-11-21 01:29:38 +01:00
parent 4365fac0b0
commit e6a4103f97
1 changed files with 7 additions and 2 deletions

View File

@ -670,11 +670,16 @@ class DefinitionResolver
|| $node instanceof Node\Expr\Assign || $node instanceof Node\Expr\Assign
|| $node instanceof Node\Expr\AssignOp || $node instanceof Node\Expr\AssignOp
) { ) {
if ($node instanceof Node\Stmt\PropertyProperty || $node instanceof Node\Const_) {
$docBlockHolder = $node->getAttribute('parentNode');
} else {
$docBlockHolder = $node;
}
// Property, constant or variable // Property, constant or variable
// Use @var tag // Use @var tag
if ( if (
($parent = $node->getAttribute('parentNode')) isset($docBlockHolder)
&& ($docBlock = $parent->getAttribute('docBlock')) && ($docBlock = $docBlockHolder->getAttribute('docBlock'))
&& !empty($varTags = $docBlock->getTagsByName('var')) && !empty($varTags = $docBlock->getTagsByName('var'))
&& ($type = $varTags[0]->getType()) && ($type = $varTags[0]->getType())
) { ) {