-
-
Notifications
You must be signed in to change notification settings - Fork 931
Open
Description
Feature request
https://phpstan.org/r/847f855b-835a-4ff6-b466-e4b30717076f
/** @param list<mixed> $arr */
function foo(array $arr): void {
foreach ($arr as $v) {
bar($arr);
}
for ($i = 0; $i < count($arr); ++$i) {
bar($arr);
}
}
/** @param non-empty-list<mixed> $arr */
function bar(array $arr): void {}
Inside the foreach
loop $arr
can not be empty.
It already works when using a for
loop instead of foreach
.
Did PHPStan help you today? Did it make you happy in any way?
No response
Metadata
Metadata
Assignees
Labels
No labels