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 @@ -1363,6 +1363,16 @@ public function testBug10657(): void
13631363 $ this ->analyse ([__DIR__ . '/data/bug-10657.php ' ], []);
13641364 }
13651365
1366+ public function testBug6830 (): void
1367+ {
1368+ $ this ->cliArgumentsVariablesRegistered = true ;
1369+ $ this ->polluteScopeWithLoopInitialAssignments = false ;
1370+ $ this ->checkMaybeUndefinedVariables = true ;
1371+ $ this ->polluteScopeWithAlwaysIterableForeach = true ;
1372+
1373+ $ this ->analyse ([__DIR__ . '/data/bug-6830.php ' ], []);
1374+ }
1375+
13661376 public function testBug14117 (): void
13671377 {
13681378 $ this ->cliArgumentsVariablesRegistered = true ;
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Bug6830 ;
6+
7+ /** @param array<bool> $bools */
8+ function test (array $ bools ): void
9+ {
10+ foreach ($ bools as $ bool ) {
11+ if ($ bool ) {
12+ $ foo = 'foo ' ;
13+ }
14+ if ($ bool ) {
15+ echo $ foo ;
16+ }
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments