1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Clobber empty array when combining with object-like

This commit is contained in:
Matthew Brown 2016-10-02 19:33:46 -04:00
parent 17d99b5fa7
commit a84587e6c3

View File

@ -490,6 +490,16 @@ abstract class Type
$key_type = isset($key_types[$generic_type]) ? $key_types[$generic_type] : [];
// if we're merging an empty array with an object-like, clobber empty array
if ($generic_type === 'array'
&& count($value_type) === 1
&& isset($value_type['empty'])
&& count($key_type) === 1
&& isset($key_type['empty'])
) {
continue;
}
$expanded_key_types = [];
foreach ($key_type as $expandable_key_type) {