1
0
Fork 0
pull/701/merge
julianschwuchow 2019-01-25 14:41:36 +00:00 committed by GitHub
commit 161b0516ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -822,8 +822,22 @@ class DefinitionResolver
} }
// ASSIGNMENT EXPRESSION // ASSIGNMENT EXPRESSION
// first var tag will be used to resolve the type if present
// otherwise
// $a = $myExpression => resolves to the type of the right-hand operand // $a = $myExpression => resolves to the type of the right-hand operand
if ($expr instanceof Node\Expression\AssignmentExpression) { if ($expr instanceof Node\Expression\AssignmentExpression) {
$declarationNode =
ParserHelpers\tryGetPropertyDeclaration($expr) ??
ParserHelpers\tryGetConstOrClassConstDeclaration($expr);
$declarationNode = $declarationNode ?? $expr;
if (
($docBlock = $this->getDocBlock($declarationNode))
&& !empty($varTags = $docBlock->getTagsByName('var'))
&& ($type = $varTags[0]->getType())
) {
return $type;
}
return $this->resolveExpressionNodeToType($expr->rightOperand); return $this->resolveExpressionNodeToType($expr->rightOperand);
} }