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