diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php index f77ca5f8d31..aafdd9648e0 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php @@ -453,10 +453,6 @@ private static function analyzeArrayItem( } } - if ($array_creation_info->item_value_atomic_types && !$array_creation_info->can_create_objectlike) { - return; - } - if ($item_value_type = $statements_analyzer->node_data->getType($item->value)) { if ($item_key_value !== null && count($array_creation_info->property_types) <= 100) { $array_creation_info->property_types[$item_key_value] = $item_value_type; diff --git a/tests/ArrayAssignmentTest.php b/tests/ArrayAssignmentTest.php index 3400fbbacc4..3d5246416d9 100644 --- a/tests/ArrayAssignmentTest.php +++ b/tests/ArrayAssignmentTest.php @@ -1537,7 +1537,7 @@ function test(): array { $x = [...test(), "a" => "b"]; ', - 'assertions' => ['$x' => 'non-empty-array'] + 'assertions' => ['$x' => 'non-empty-array'] ], 'ArrayOffsetNumericSupPHPINTMAX' => [ ' [ + ' + */ + function posiviteIntegers(): array + { + return [1]; + } + + $_a = [...posiviteIntegers(), int()];', + 'assertions' => [ + '$_a' => 'non-empty-list', + ], + [], + '8.1' + ], ]; }