mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix combining class string types with explicit ones
This commit is contained in:
parent
ee6bf74a41
commit
d5f4c24ee0
@ -475,6 +475,15 @@ class TypeCombination
|
||||
}
|
||||
|
||||
if ($combination->class_string_types) {
|
||||
if ($combination->strings) {
|
||||
foreach ($combination->strings as $k => $string) {
|
||||
if ($string instanceof TLiteralClassString) {
|
||||
$combination->class_string_types[$string->value] = new TNamedObject($string->value);
|
||||
unset($combination->strings[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($combination->value_types['string'])) {
|
||||
$object_type = self::combineTypes(
|
||||
array_values($combination->class_string_types),
|
||||
|
@ -473,6 +473,13 @@ class TypeCombinationTest extends TestCase
|
||||
'class-string<Iterator>',
|
||||
],
|
||||
],
|
||||
'combineClassStringsWithLiteral' => [
|
||||
'class-string',
|
||||
[
|
||||
'class-string',
|
||||
'Exception::class',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user