mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
don't stop analyzing array, even if we already have a type and we can't create an object like
This commit is contained in:
parent
4a35a85939
commit
c17af4128e
@ -453,10 +453,6 @@ class ArrayAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -1693,6 +1693,28 @@ class ArrayAssignmentTest extends TestCase
|
||||
[],
|
||||
'8.1'
|
||||
],
|
||||
'unpackArrayWithTwoTypesNotObjectLike' => [
|
||||
'<?php
|
||||
function int(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<positive-int>
|
||||
*/
|
||||
function posiviteIntegers(): array
|
||||
{
|
||||
return [1];
|
||||
}
|
||||
|
||||
$_a = [...posiviteIntegers(), int()];',
|
||||
'assertions' => [
|
||||
'$_a' => 'non-empty-list<int>',
|
||||
],
|
||||
[],
|
||||
'8.1'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user