diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php index a080bea80..c071a7411 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php @@ -514,11 +514,8 @@ class ArrayAssignmentAnalyzer $array_atomic_key_type = Type::getArrayKey(); } - if ($offset_already_existed - && $parent_var_id - && ($parent_type = $context->vars_in_scope[$parent_var_id] ?? null) - ) { - if ($parent_type->hasList() && strpos($parent_var_id, '[') === false) { + if ($parent_var_id && ($parent_type = $context->vars_in_scope[$parent_var_id] ?? null)) { + if ($offset_already_existed && $parent_type->hasList() && strpos($parent_var_id, '[') === false) { $array_atomic_type_list = $value_type; } elseif ($parent_type->hasClassStringMap() && $key_type