1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Treat iterables as traversable when comparing to named object

This commit is contained in:
Brown 2020-05-31 00:55:45 -04:00
parent c1d8912a9b
commit 86b894eca5

View File

@ -514,6 +514,16 @@ class TypeAnalyzer
$allow_interface_equality,
?TypeComparisonResult $atomic_comparison_result
) {
if ($container_type_part instanceof TIterable
&& !$container_type_part->extra_types
&& !$input_type_part instanceof TIterable
) {
$container_type_part = new TGenericObject(
'Traversable',
$container_type_part->type_params
);
}
$intersection_input_types = $input_type_part->extra_types ?: [];
$intersection_input_types[$input_type_part->getKey(false)] = $input_type_part;