File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
tests/PHPStan/Rules/Arrays Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -907,4 +907,11 @@ public function testBug11602(): void
907907 $ this ->analyse ([__DIR__ . '/data/bug-11602.php ' ], []);
908908 }
909909
910+ public function testBug12593 (): void
911+ {
912+ $ this ->reportPossiblyNonexistentGeneralArrayOffset = true ;
913+
914+ $ this ->analyse ([__DIR__ . '/data/bug-12593.php ' ], []);
915+ }
916+
910917}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug12593 ;
4+
5+ class HelloWorld
6+ {
7+ /**
8+ * @param list<int> $indexes
9+ */
10+ protected function removeArguments (array $ indexes ): void
11+ {
12+ if (isset ($ _SERVER ['argv ' ]) && is_array ($ _SERVER ['argv ' ])) {
13+ foreach ($ indexes as $ index ) {
14+ if (isset ($ _SERVER ['argv ' ][$ index ])) {
15+ unset($ _SERVER ['argv ' ][$ index ]);
16+ }
17+ }
18+ }
19+ }
20+ }
21+
22+ class HelloWorld2
23+ {
24+ /**
25+ * @param list<int> $indexes
26+ */
27+ protected function removeArguments (array $ indexes ): void
28+ {
29+ foreach ($ indexes as $ index ) {
30+ if (isset ($ _SERVER ['argv ' ]) && is_array ($ _SERVER ['argv ' ]) && isset ($ _SERVER ['argv ' ][$ index ])) {
31+ unset($ _SERVER ['argv ' ][$ index ]);
32+ }
33+ }
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments