File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
tests/PHPStan/Rules/Arrays Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -50,4 +50,9 @@ public function testBug2560(): void
5050 $ this ->analyse ([__DIR__ . '/data/bug-2560.php ' ], []);
5151 }
5252
53+ public function testBug2457 (): void
54+ {
55+ $ this ->analyse ([__DIR__ . '/data/bug-2457.php ' ], []);
56+ }
57+
5358}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug2457 ;
4+
5+ class HelloWorld
6+ {
7+ public function sayHello (array $ x , array $ y ): void
8+ {
9+ $ a = [];
10+ $ o = [];
11+
12+ foreach ($ x as $ t ) {
13+ if (!isset ($ a [$ t ])) {
14+ $ a [$ t ] = [];
15+ }
16+ $ o [] = 'x ' ;
17+ array_unshift ($ a [$ t ], count ($ o ) - 1 );
18+ }
19+
20+ foreach ($ y as $ t ) {
21+ if (!isset ($ a [$ t ])) {
22+ continue ;
23+ }
24+ foreach ($ a [$ t ] as $ b ) {
25+ // this will be reached
26+ }
27+ }
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments