File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
tests/PHPStan/Rules/Comparison Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -257,4 +257,10 @@ public function testBug12716(): void
257257 $ this ->analyse ([__DIR__ . '/data/bug-12716.php ' ], []);
258258 }
259259
260+ public function testBug3387 (): void
261+ {
262+ $ this ->treatPhpDocTypesAsCertain = true ;
263+ $ this ->analyse ([__DIR__ . '/data/bug-3387.php ' ], []);
264+ }
265+
260266}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug3387 ;
4+
5+ function (array $ items , string $ key ) {
6+ $ array = [$ key => []];
7+ foreach ($ items as $ item ) {
8+ $ array [$ key ][] = $ item ;
9+ if (count ($ array [$ key ]) > 1 ) {
10+ throw new RuntimeException ();
11+ }
12+ }
13+ };
14+
15+ function (array $ items , string $ key ) {
16+ $ array = [$ key => []];
17+ foreach ($ items as $ item ) {
18+ array_unshift ($ array [$ key ], $ item );
19+ if (count ($ array [$ key ]) > 1 ) {
20+ throw new RuntimeException ();
21+ }
22+ }
23+ };
24+
25+ function (array $ items , string $ key ) {
26+ $ array = [$ key => []];
27+ foreach ($ items as $ item ) {
28+ array_push ($ array [$ key ], $ item );
29+ if (count ($ array [$ key ]) > 1 ) {
30+ throw new RuntimeException ();
31+ }
32+ }
33+ };
You can’t perform that action at this time.
0 commit comments