mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix #1263 - return proper class string
This commit is contained in:
parent
0be6aac30c
commit
ac79e9a311
@ -1059,7 +1059,10 @@ class Union
|
||||
|
||||
$new_types[$unknown_class_string->getKey()] = $unknown_class_string;
|
||||
} elseif ($template_type_part instanceof Type\Atomic\TNamedObject) {
|
||||
$literal_class_string = new Type\Atomic\TClassString($template_type_part->value);
|
||||
$literal_class_string = new Type\Atomic\TClassString(
|
||||
$template_type_part->value,
|
||||
$template_type_part
|
||||
);
|
||||
|
||||
$new_types[$literal_class_string->getKey()] = $literal_class_string;
|
||||
}
|
||||
|
@ -485,6 +485,18 @@ class ClassStringTest extends TestCase
|
||||
}
|
||||
}'
|
||||
],
|
||||
'returnTemplatedClassString' => [
|
||||
'<?php
|
||||
/**
|
||||
* @template T
|
||||
*
|
||||
* @param class-string<T> $shouldBe
|
||||
* @return class-string<T>
|
||||
*/
|
||||
function identity(string $shouldBe) : string { return $shouldBe; }
|
||||
|
||||
identity(DateTimeImmutable::class)::createFromMutable(new DateTime());',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user