Skip to content

Commit fa6f7b2

Browse files
committed
test more variants
1 parent d8ccd7f commit fa6f7b2

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

tests/PHPStan/Analyser/nsrt/for-loop-expr.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,32 @@ function getItemsWithForLoop(array $items): array
2121
}
2222

2323
/**
24-
* @param non-empty-list<string> $items
24+
* @param list<string> $items
2525
*
26-
* @return non-empty-list<string>
26+
* @return list<string>
2727
*/
2828
function getItemsWithForLoopInvertLastCond(array $items): array
2929
{
3030
for ($i = 0; count($items) > $i; ++$i) {
3131
$items[$i] = 'hello';
3232
}
3333

34-
assertType('non-empty-list<string>', $items);
34+
assertType('list<string>', $items);
35+
return $items;
36+
}
37+
38+
39+
/**
40+
* @param array<string> $items
41+
*
42+
* @return array<string>
43+
*/
44+
function getItemsArray(array $items): array
45+
{
46+
for ($i = 0; count($items) > $i; ++$i) {
47+
$items[$i] = 'hello';
48+
}
49+
50+
assertType('array<string>', $items);
3551
return $items;
3652
}

0 commit comments

Comments
 (0)