1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Use fallback assignment type when the property doesn’t exist on the class

This commit is contained in:
Matt Brown 2020-12-01 16:59:44 -05:00 committed by Daniil Gentili
parent 71b291caac
commit 2a30e49d88
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -759,6 +759,8 @@ class InstancePropertyAssignmentAnalyzer
return []; return [];
} }
$context_type = $context_type ?: $assignment_value_type;
if ($var_id && $context_type) { if ($var_id && $context_type) {
if ($context->collect_initializations if ($context->collect_initializations
&& $lhs_var_id === '$this' && $lhs_var_id === '$this'