mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix union argument types check against templated param
This commit is contained in:
parent
8d15fa1d79
commit
cfd0f062f7
@ -585,7 +585,7 @@ class TemplateStandinTypeReplacer
|
||||
|
||||
if (!empty($classlike_storage->template_extended_params[$base_type->value])) {
|
||||
$atomic_input_type = new TGenericObject(
|
||||
$atomic_input_type->value,
|
||||
$base_type->value,
|
||||
array_values($classlike_storage->template_extended_params[$base_type->value]),
|
||||
);
|
||||
|
||||
|
@ -17,6 +17,29 @@ class FunctionCallTest extends TestCase
|
||||
public function providerValidCodeParse(): iterable
|
||||
{
|
||||
return [
|
||||
'callTemplatedFunctionWithUnionArgument' => [
|
||||
'code' => '<?php
|
||||
/** @template T */
|
||||
interface Message {}
|
||||
|
||||
/** @implements Message<int> */
|
||||
final class FirstMessage implements Message {}
|
||||
|
||||
/** @implements Message<int> */
|
||||
final class SecondMessage implements Message {}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param Message<T> $msg
|
||||
*/
|
||||
function test(Message $msg): void {}
|
||||
|
||||
/** @var FirstMessage|SecondMessage $message */;
|
||||
test($message);',
|
||||
'assertions' => [],
|
||||
'ignored_issues' => [],
|
||||
'php_version' => '8.0',
|
||||
],
|
||||
'callFunctionWithTemplateClassStringWillNotFail' => [
|
||||
'code' => '<?php
|
||||
/** @param class-string<SplFixedArray<string>> $classString */
|
||||
|
Loading…
x
Reference in New Issue
Block a user