mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Combine value types at once
This commit is contained in:
parent
a41d5c5b4f
commit
a64a30cdda
@ -431,7 +431,7 @@ class SimpleTypeInferer
|
||||
}
|
||||
|
||||
$item_key_type_atomic = [];
|
||||
$item_value_type = null;
|
||||
$item_value_type_atomic = [];
|
||||
|
||||
$property_types = [];
|
||||
$class_strings = [];
|
||||
@ -527,18 +527,10 @@ class SimpleTypeInferer
|
||||
}
|
||||
}
|
||||
|
||||
if ($item_value_type) {
|
||||
$item_value_type = Type::combineUnionTypes(
|
||||
$single_item_value_type,
|
||||
$item_value_type,
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
30
|
||||
);
|
||||
} else {
|
||||
$item_value_type = $single_item_value_type;
|
||||
}
|
||||
$item_value_type_atomic = array_merge(
|
||||
$item_value_type_atomic,
|
||||
array_values($single_item_value_type->getAtomicTypes())
|
||||
);
|
||||
}
|
||||
|
||||
$item_key_type = null;
|
||||
@ -552,6 +544,17 @@ class SimpleTypeInferer
|
||||
);
|
||||
}
|
||||
|
||||
$item_value_type = null;
|
||||
if ($item_value_type_atomic) {
|
||||
$item_value_type = TypeCombiner::combine(
|
||||
$item_value_type_atomic,
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
30
|
||||
);
|
||||
}
|
||||
|
||||
// if this array looks like an object-like array, let's return that instead
|
||||
if ($item_value_type
|
||||
&& $item_key_type
|
||||
|
Loading…
x
Reference in New Issue
Block a user