1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 17:52:45 +01:00

Be more general with arrays

This commit is contained in:
Matthew Brown 2016-09-15 16:42:50 -04:00
parent 24fd84617f
commit dff23e9d74

View File

@ -82,10 +82,7 @@ abstract class Type
$generic_type_value = self::fixScalarTerms($generic_type->value); $generic_type_value = self::fixScalarTerms($generic_type->value);
if ($generic_type_value === 'array' && count($generic_params) === 1) { if ($generic_type_value === 'array' && count($generic_params) === 1) {
array_unshift($generic_params, new Union([ array_unshift($generic_params, Type::getMixed());
new Atomic('int'),
new Atomic('string')
]));
} }
if (!$generic_params) { if (!$generic_params) {
@ -221,10 +218,7 @@ abstract class Type
$type = new Generic( $type = new Generic(
'array', 'array',
[ [
new Union([ Type::getMixed(),
new Atomic('int'),
new Atomic('string')
]),
Type::getMixed() Type::getMixed()
] ]
); );