1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00

Add null check

This commit is contained in:
Matt Brown 2021-02-08 09:44:46 -05:00
parent 509aadc08a
commit 2b2d1c1060

View File

@ -373,12 +373,14 @@ class ArrayMapReturnTypeProvider implements \Psalm\Plugin\EventHandler\FunctionR
$callable_type = $statements_source->node_data->getType($function_call_arg->value);
foreach ($callable_type->getAtomicTypes() as $atomic_type) {
if ($atomic_type instanceof Type\Atomic\TKeyedArray
&& \count($atomic_type->properties) === 2
&& isset($atomic_type->properties[0])
) {
$lhs_instance_type = clone $atomic_type->properties[0];
if ($callable_type) {
foreach ($callable_type->getAtomicTypes() as $atomic_type) {
if ($atomic_type instanceof Type\Atomic\TKeyedArray
&& \count($atomic_type->properties) === 2
&& isset($atomic_type->properties[0])
) {
$lhs_instance_type = clone $atomic_type->properties[0];
}
}
}