Use property and constant values
parent
49b526d7e1
commit
4365fac0b0
|
@ -671,17 +671,23 @@ class DefinitionResolver
|
||||||
|| $node instanceof Node\Expr\AssignOp
|
|| $node instanceof Node\Expr\AssignOp
|
||||||
) {
|
) {
|
||||||
// Property, constant or variable
|
// Property, constant or variable
|
||||||
|
// Use @var tag
|
||||||
if (
|
if (
|
||||||
($parent = $node->getAttribute('parentNode'))
|
($parent = $node->getAttribute('parentNode'))
|
||||||
&& ($docBlock = $parent->getAttribute('docBlock'))
|
&& ($docBlock = $parent->getAttribute('docBlock'))
|
||||||
&& !empty($varTags = $docBlock->getTagsByName('var'))
|
&& !empty($varTags = $docBlock->getTagsByName('var'))
|
||||||
&& ($type = $varTags[0]->getType())
|
&& ($type = $varTags[0]->getType())
|
||||||
) {
|
) {
|
||||||
// Use @var tag
|
|
||||||
return $type;
|
return $type;
|
||||||
}
|
}
|
||||||
if ($node instanceof Node\Expr\Assign || $node instanceof Node\Expr\AssignOp) {
|
// Resolve the expression
|
||||||
// Resolve the expression
|
if ($node instanceof Node\Stmt\PropertyProperty) {
|
||||||
|
if ($node->default) {
|
||||||
|
return $this->resolveExpressionNodeToType($node->default);
|
||||||
|
}
|
||||||
|
} else if ($node instanceof Node\Const_) {
|
||||||
|
return $this->resolveExpressionNodeToType($node->value);
|
||||||
|
} else if ($node instanceof Node\Expr\Assign || $node instanceof Node\Expr\AssignOp) {
|
||||||
return $this->resolveExpressionNodeToType($node);
|
return $this->resolveExpressionNodeToType($node);
|
||||||
}
|
}
|
||||||
// TODO: read @property tags of class
|
// TODO: read @property tags of class
|
||||||
|
|
Loading…
Reference in New Issue