Skip to content

Commit 636a315

Browse files
committed
Create bug-11846.php
1 parent fe08dab commit 636a315

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Bug11846;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
function demo(): void
8+
{
9+
$outerList = [];
10+
$idList = [1, 2];
11+
12+
foreach ($idList as $id) {
13+
$outerList[$id] = [];
14+
array_push($outerList[$id], []);
15+
}
16+
assertType('non-empty-array<1|2, array{}|array{array{}}>', $outerList);
17+
18+
foreach ($outerList as $key => $outerElement) {
19+
$result = false;
20+
21+
assertType('array{}|array{array{}}', $outerElement);
22+
foreach ($outerElement as $innerElement) {
23+
$result = true;
24+
}
25+
assertType('bool', $result); // could be 'true'
26+
27+
}
28+
}

0 commit comments

Comments
 (0)