Skip to content

Commit 9dafb36

Browse files
vlada-dudrVladimír Dudr
and
Vladimír Dudr
authoredJan 20, 2023
Fix crash on MissingToken (phpactor#2049)
Co-authored-by: Vladimír Dudr <vladimir@tango-dj.cz>
1 parent 58119bb commit 9dafb36

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎lib/Indexer/Adapter/Tolerant/Indexer/ClassDeclarationIndexer.php

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Phpactor\Indexer\Adapter\Tolerant\Indexer;
44

5+
use Microsoft\PhpParser\MissingToken;
56
use Microsoft\PhpParser\Node;
67
use Phpactor\Indexer\Model\Name\FullyQualifiedName;
78
use Phpactor\Indexer\Model\Record\ClassRecord;
@@ -56,6 +57,11 @@ private function indexBaseClass(Index $index, ClassRecord $record, ClassDeclarat
5657
return;
5758
}
5859

60+
/** @phpstan-ignore-next-line */
61+
if ($baseClass instanceof MissingToken) {
62+
return;
63+
}
64+
5965
$name = $baseClass->getResolvedName();
6066
$record->addImplements(FullyQualifiedName::fromString((string)$name));
6167
$baseClassRecord = $index->get(ClassRecord::fromName($name));

0 commit comments

Comments
 (0)
Please sign in to comment.