Skip to content

Commit 6044cc7

Browse files
committedOct 26, 2023
Combining a array value empty list with a non-empty list was returning a non-empty-list
1 parent 147505c commit 6044cc7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
 

‎src/Psalm/Internal/Type/TypeCombiner.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ private static function getArrayTypeFromGenericParams(
15161516
$generic_type_params[1],
15171517
$objectlike_generic_type,
15181518
$codebase,
1519-
$overwrite_empty_array,
1519+
false,
15201520
$allow_mixed_union,
15211521
);
15221522
}

‎tests/ArrayAssignmentTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -2048,6 +2048,15 @@ function getQueryParams(): array
20482048
return $queryParams;
20492049
}',
20502050
],
2051+
'AssignListToNonEmptyList' => [
2052+
'code' => '<?php
2053+
/** @var array<int, non-empty-list<string>> $l*/
2054+
$l = [];
2055+
$l[] = [];',
2056+
'assertions' => [
2057+
'$l===' => 'non-empty-array<int, list<string>>',
2058+
],
2059+
],
20512060
];
20522061
}
20532062

0 commit comments

Comments
 (0)
Please sign in to comment.