1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-13 09:47:29 +01:00

Merge pull request #6608 from orklah/foreach-on-list

foreach on list gives a positive|0 offset
This commit is contained in:
orklah 2021-10-07 20:16:11 +02:00 committed by GitHub
commit 49bb065dc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -449,7 +449,7 @@ class ForeachAnalyzer
? new Type\Union([ ? new Type\Union([
new Type\Atomic\TDependentListKey($list_var_id) new Type\Atomic\TDependentListKey($list_var_id)
]) ])
: Type::getInt(), : new Type\Union([new Type\Atomic\TIntRange(0, null)]),
$iterator_atomic_type->type_param $iterator_atomic_type->type_param
]); ]);
} elseif (!$iterator_atomic_type instanceof Type\Atomic\TNonEmptyArray) { } elseif (!$iterator_atomic_type instanceof Type\Atomic\TNonEmptyArray) {