From c1ca6c27d589ae108c729101d7328c35745c45e6 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Tue, 13 Sep 2016 17:35:30 -0400 Subject: [PATCH] If we do not know, do not assume --- src/Psalm/Checker/StatementsChecker.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Psalm/Checker/StatementsChecker.php b/src/Psalm/Checker/StatementsChecker.php index 515100544..f1f9577e1 100644 --- a/src/Psalm/Checker/StatementsChecker.php +++ b/src/Psalm/Checker/StatementsChecker.php @@ -1911,10 +1911,7 @@ class StatementsChecker } if ($stmt->keyVar) { - $foreach_context->vars_in_scope[$stmt->keyVar->name] = $key_type ?: new Type\Union([ - new Type\Atomic('int'), - new Type\Atomic('string') - ]); + $foreach_context->vars_in_scope[$stmt->keyVar->name] = $key_type ?: Type::getMixed(); $foreach_context->vars_possibly_in_scope[$stmt->keyVar->name] = true; $this->registerVariable($stmt->keyVar->name, $stmt->getLine()); }