mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Merge pull request #8376 from Daeroni/fix-8373
Use classlike_storage_provider only if it has the required data
This commit is contained in:
commit
aae539560b
@ -1138,7 +1138,7 @@ class TemplateStandinTypeReplacer
|
||||
): array {
|
||||
if ($input_type_part instanceof TGenericObject || $input_type_part instanceof TIterable) {
|
||||
$input_type_params = $input_type_part->type_params;
|
||||
} else {
|
||||
} elseif ($codebase->classlike_storage_provider->has($input_type_part->value)) {
|
||||
$class_storage = $codebase->classlike_storage_provider->get($input_type_part->value);
|
||||
|
||||
$container_class = $container_type_part->value;
|
||||
@ -1150,6 +1150,8 @@ class TemplateStandinTypeReplacer
|
||||
} else {
|
||||
$input_type_params = array_fill(0, count($class_storage->template_types ?? []), Type::getMixed());
|
||||
}
|
||||
} else {
|
||||
$input_type_params = [];
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -3826,6 +3826,22 @@ class ClassTemplateTest extends TestCase
|
||||
}
|
||||
}',
|
||||
],
|
||||
'undefined class in function dockblock' => [
|
||||
'<?php
|
||||
/**
|
||||
* @psalm-suppress UndefinedDocblockClass
|
||||
*
|
||||
* @param DoesNotExist<int> $baz
|
||||
*/
|
||||
function foobar(DoesNotExist $baz): void {}
|
||||
|
||||
/**
|
||||
* @psalm-suppress UndefinedDocblockClass, UndefinedClass
|
||||
* @var DoesNotExist
|
||||
*/
|
||||
$baz = new DoesNotExist();
|
||||
foobar($baz);',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user