diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php index 89aa71e98..af89ec0df 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php @@ -793,8 +793,8 @@ class CallAnalyzer ); } } - } elseif (isset($arg_var_id) && isset($context->vars_in_scope[$arg_var_id])) { - $other_type = $context->vars_in_scope[$arg_var_id]; + } elseif (isset($context->vars_in_scope[$assertion_var_id])) { + $other_type = $context->vars_in_scope[$assertion_var_id]; if (self::isNewTypeNarrowingDownOldType($other_type, $union)) { foreach ($union->getAtomicTypes() as $atomic_type) { if ($assertion_type instanceof TTemplateParam