From 2a30e49d88f5e06d4d6075eafc6ea0b6b9d810e3 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Tue, 1 Dec 2020 16:59:44 -0500 Subject: [PATCH] =?UTF-8?q?Use=20fallback=20assignment=20type=20when=20the?= =?UTF-8?q?=20property=20doesn=E2=80=99t=20exist=20on=20the=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assignment/InstancePropertyAssignmentAnalyzer.php | 2 ++ 1 file changed, 2 insertions(+) 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'