Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions server/lib/PhpStan/PhpStanUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public function resolveType(Node $node, string $class_name, ?array $generic_args
// Resolve ImportAlias
$namespace = null;
for ($i = 0; isset($alias['namespace']); $i++) {
if ($i > $this->max_recursion) {
throw new \Exception("Maximum recusion level ({$this->max_recursion}) reached: Failed importing {$alias['name']} from {$alias['namespace']}");
if ($i >= $this->max_recursion) {
throw new \Exception("Maximum recusion level ({$this->max_recursion}) reached while resolving alias {$alias['name']} from {$alias['namespace']}");
}
$namespace = $alias['namespace'];
$alias = $this->resolveImportAlias($alias);
Expand Down
2 changes: 1 addition & 1 deletion server/tests/UnitTests/PhpStan/PhpStanUtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public function testResolveTypeInfiniteLoop(): void {
FakeLoop2::class => true,
], $utils->testOnlyGetAliasCacheKeys());
$this->assertSame(
'Maximum recusion level (100) reached: Failed importing InfiniteLoop from PhpTypeScriptApi\Tests\UnitTests\PhpStan\FakeLoop1',
'Maximum recusion level (100) reached while resolving alias InfiniteLoop from PhpTypeScriptApi\Tests\UnitTests\PhpStan\FakeLoop2',
$th->getMessage(),
);
}
Expand Down
Loading