diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php index 485a1f1b2..8cb2ef2ef 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php @@ -759,6 +759,8 @@ class InstancePropertyAssignmentAnalyzer return []; } + $context_type = $context_type ?: $assignment_value_type; + if ($var_id && $context_type) { if ($context->collect_initializations && $lhs_var_id === '$this'