mirror of
https://github.com/danog/psalm.git
synced 2024-12-02 17:52:45 +01:00
Fixes
This commit is contained in:
parent
51e6b1155d
commit
700e066539
@ -612,6 +612,7 @@ class ArrayAssignmentAnalyzer
|
||||
$prop_count
|
||||
);
|
||||
} else if ($prop_count !== null) {
|
||||
assert($array_atomic_type_list !== null);
|
||||
$array_atomic_type = new TKeyedArray(
|
||||
array_fill(
|
||||
0,
|
||||
@ -640,6 +641,7 @@ class ArrayAssignmentAnalyzer
|
||||
'parent_nodes' => $root_type->parent_nodes
|
||||
]);
|
||||
} else {
|
||||
assert($array_atomic_type_list !== null);
|
||||
$array_atomic_type = new TKeyedArray(
|
||||
array_fill(
|
||||
0,
|
||||
@ -660,6 +662,7 @@ class ArrayAssignmentAnalyzer
|
||||
$array_atomic_type_list
|
||||
);
|
||||
} else {
|
||||
assert($array_atomic_type_array !== null);
|
||||
$array_atomic_type = new TNonEmptyArray(
|
||||
$array_atomic_type_array
|
||||
);
|
||||
@ -671,7 +674,12 @@ class ArrayAssignmentAnalyzer
|
||||
?? ($array_atomic_type_list !== null
|
||||
? Type::getNonEmptyList($array_atomic_type_list)
|
||||
: null
|
||||
) ?? new TNonEmptyArray($array_atomic_type_array);
|
||||
) ?? ($array_atomic_type_array !== null
|
||||
? new TNonEmptyArray($array_atomic_type_array)
|
||||
: null
|
||||
)
|
||||
;
|
||||
assert($array_atomic_type !== null);
|
||||
|
||||
$array_assignment_type = new Union([$array_atomic_type]);
|
||||
|
||||
|
@ -109,7 +109,10 @@ class ArrayMergeReturnTypeProvider implements FunctionReturnTypeProviderInterfac
|
||||
} elseif (!$is_replace) {
|
||||
if ($unpacking_indefinite_number_of_args) {
|
||||
$added_inner_values = true;
|
||||
$inner_value_types[] = $type;
|
||||
$inner_value_types = array_merge(
|
||||
$inner_value_types,
|
||||
array_values($type->getAtomicTypes())
|
||||
);
|
||||
} else {
|
||||
$generic_properties[] = $type;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class ArrayReverseReturnTypeProvider implements FunctionReturnTypeProviderInterf
|
||||
? $array_atomic_type
|
||||
: null;
|
||||
|
||||
if (!$first_arg_array) {
|
||||
if (!$first_arg_array || !$first_arg_type) {
|
||||
return Type::getArray();
|
||||
}
|
||||
|
||||
|
@ -341,6 +341,7 @@ class TKeyedArray extends Atomic
|
||||
return new TArray([$key_type, $value_type]);
|
||||
}
|
||||
|
||||
assert($key_types !== []);
|
||||
$key_type = TypeCombiner::combine($key_types);
|
||||
|
||||
if ($this->fallback_params !== null) {
|
||||
|
Loading…
Reference in New Issue
Block a user