Skip to content

Commit 4bcf776

Browse files
committed
another test
1 parent e32987c commit 4bcf776

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,11 @@ public function testBug10492(): void
10071007
]);
10081008
}
10091009

1010+
public function testBug12574a(): void
1011+
{
1012+
$this->analyse([__DIR__ . '/data/bug-12574a.php'], []);
1013+
}
1014+
10101015
public function testBug12926(): void
10111016
{
10121017
$this->reportPossiblyNonexistentGeneralArrayOffset = true;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Bug12574a;
4+
5+
function doFoo() {
6+
$i = 10;
7+
$x = [];
8+
while ($i-- > 0) {
9+
$r = rand(1, 10);
10+
if (!isset($x[$r])) {
11+
$x[$r] = 1;
12+
}
13+
var_dump($x[$r]);
14+
}
15+
}

0 commit comments

Comments
 (0)