1
0
Fork 0

return class containing self instead of self

pull/550/head
Philip Nelson 2017-12-10 22:07:43 +11:00
parent 50de9bb28e
commit 4186d8f9ce
2 changed files with 4 additions and 2 deletions

View File

@ -1064,7 +1064,9 @@ class DefinitionResolver
// Resolve a string like "bool" to a type object
return $this->typeResolver->resolve($node->returnType->getText($node->getFileContents()));
} elseif ($node->returnType->getResolvedName() === 'self') {
return new Types\Self_();
$classNode = $node->getFirstAncestor(Node\Statement\ClassDeclaration::class);
$classFqn = (string)$classNode->getNamespacedName();
return new Types\Object_(new Fqsen('\\' . $classFqn));
}
return new Types\Object_(new Fqsen('\\' . (string)$node->returnType->getResolvedName()));
}

View File

@ -588,7 +588,7 @@ class CompletionTest extends TestCase
new CompletionItem(
'foo',
CompletionItemKind::METHOD,
'self',
'\FooClass',
null,
null,
null,