Skip to content

Commit 3b63336

Browse files
roblourensfelixfbecker
authored andcommitted
Fix error getting completions for 'new static' type (#405)
1 parent 8d1732e commit 3b63336

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/DefinitionResolver.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,11 +906,12 @@ public function resolveClassNameToType($class): Type
906906
// Anonymous class
907907
return new Types\Object_;
908908
}
909-
$className = (string)$class->getResolvedName();
910-
911-
if ($className === 'static') {
909+
if ($class instanceof PhpParser\Token && $class->kind === PhpParser\TokenKind::StaticKeyword) {
910+
// `new static`
912911
return new Types\Static_;
913912
}
913+
$className = (string)$class->getResolvedName();
914+
914915
if ($className === 'self' || $className === 'parent') {
915916
$classNode = $class->getFirstAncestor(Node\Statement\ClassDeclaration::class);
916917
if ($className === 'parent') {

0 commit comments

Comments
 (0)