diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php index 713de3d8d..7b36e59bc 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php @@ -449,7 +449,7 @@ class ForeachAnalyzer ? new Type\Union([ new Type\Atomic\TDependentListKey($list_var_id) ]) - : Type::getInt(), + : new Type\Union([new Type\Atomic\TIntRange(0, null)]), $iterator_atomic_type->type_param ]); } elseif (!$iterator_atomic_type instanceof Type\Atomic\TNonEmptyArray) {