File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
tests/PHPStan/Rules/Variables Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1353,6 +1353,16 @@ public function testBug5477(): void
13531353 $ this ->analyse ([__DIR__ . '/data/bug-5477.php ' ], []);
13541354 }
13551355
1356+ public function testBug10657 (): void
1357+ {
1358+ $ this ->cliArgumentsVariablesRegistered = true ;
1359+ $ this ->polluteScopeWithLoopInitialAssignments = false ;
1360+ $ this ->checkMaybeUndefinedVariables = true ;
1361+ $ this ->polluteScopeWithAlwaysIterableForeach = true ;
1362+
1363+ $ this ->analyse ([__DIR__ . '/data/bug-10657.php ' ], []);
1364+ }
1365+
13561366 public function testBug14117 (): void
13571367 {
13581368 $ this ->cliArgumentsVariablesRegistered = true ;
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug10657 ;
4+
5+ class HelloWorld
6+ {
7+ public function sayHello (bool $ flag ): void
8+ {
9+ for ($ i = 0 ; $ i < 10 ; $ i ++) {
10+ if ($ flag ) {
11+ $ foo = 'bar ' ;
12+ }
13+ if ($ flag ) {
14+ echo $ foo ;
15+ }
16+ }
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments