1
0
Fork 0

ensure we get a class declaration

pull/550/head
Philip Nelson 2017-12-11 20:07:50 +11:00
parent a153d71266
commit f4648689da
1 changed files with 4 additions and 2 deletions

View File

@ -1065,9 +1065,11 @@ class DefinitionResolver
return $this->typeResolver->resolve($node->returnType->getText($node->getFileContents())); return $this->typeResolver->resolve($node->returnType->getText($node->getFileContents()));
} elseif ($node->returnType->getResolvedName() === 'self') { } elseif ($node->returnType->getResolvedName() === 'self') {
$classNode = $node->getFirstAncestor(Node\Statement\ClassDeclaration::class); $classNode = $node->getFirstAncestor(Node\Statement\ClassDeclaration::class);
if ($classNode) {
$classFqn = (string)$classNode->getNamespacedName(); $classFqn = (string)$classNode->getNamespacedName();
return new Types\Object_(new Fqsen('\\' . $classFqn)); return new Types\Object_(new Fqsen('\\' . $classFqn));
} }
}
return new Types\Object_(new Fqsen('\\' . (string)$node->returnType->getResolvedName())); return new Types\Object_(new Fqsen('\\' . (string)$node->returnType->getResolvedName()));
} }
// Unknown return type // Unknown return type