1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix #3142 - array_unique should remove count info

This commit is contained in:
Matthew Brown 2020-04-14 11:08:45 -04:00
parent d470903722
commit e4bfe9e6be

View File

@ -45,7 +45,13 @@ class ArrayUniqueReturnTypeProvider implements \Psalm\Plugin\Hook\FunctionReturn
}
if ($first_arg_array instanceof Type\Atomic\TArray) {
return new Type\Union([clone $first_arg_array]);
$first_arg_array = clone $first_arg_array;
if ($first_arg_array instanceof Type\Atomic\TNonEmptyArray) {
$first_arg_array->count = null;
}
return new Type\Union([$first_arg_array]);
}
if ($first_arg_array instanceof Type\Atomic\TList) {