@@ -1257,4 +1257,80 @@ public function testBug12944(): void
12571257 $ this ->analyse ([__DIR__ . '/data/bug-12944.php ' ], []);
12581258 }
12591259
1260+ public function testBug9023 (): void
1261+ {
1262+ $ this ->cliArgumentsVariablesRegistered = true ;
1263+ $ this ->polluteScopeWithLoopInitialAssignments = false ;
1264+ $ this ->checkMaybeUndefinedVariables = true ;
1265+ $ this ->polluteScopeWithAlwaysIterableForeach = true ;
1266+
1267+ $ this ->analyse ([__DIR__ . '/data/bug-9023.php ' ], []);
1268+ }
1269+
1270+ public function testBug11984 (): void
1271+ {
1272+ $ this ->cliArgumentsVariablesRegistered = true ;
1273+ $ this ->polluteScopeWithLoopInitialAssignments = false ;
1274+ $ this ->checkMaybeUndefinedVariables = true ;
1275+ $ this ->polluteScopeWithAlwaysIterableForeach = true ;
1276+
1277+ $ this ->analyse ([__DIR__ . '/data/bug-11984.php ' ], []);
1278+ }
1279+
1280+ #[DataProvider('dataBug11545 ' )]
1281+ public function testBug11545 (bool $ polluteScopeWithLoopInitialAssignments ): void
1282+ {
1283+ $ this ->cliArgumentsVariablesRegistered = true ;
1284+ $ this ->polluteScopeWithLoopInitialAssignments = $ polluteScopeWithLoopInitialAssignments ;
1285+ $ this ->checkMaybeUndefinedVariables = true ;
1286+ $ this ->polluteScopeWithAlwaysIterableForeach = true ;
1287+
1288+ $ errors = [];
1289+ if (!$ polluteScopeWithLoopInitialAssignments ) {
1290+ $ errors [] = [
1291+ 'Variable $result might not be defined. ' ,
1292+ 24 ,
1293+ ];
1294+ }
1295+
1296+ $ this ->analyse ([__DIR__ . '/data/bug-11545.php ' ], $ errors );
1297+ }
1298+
1299+ /** @return iterable<array{bool}> */
1300+ public static function dataBug11545 (): iterable
1301+ {
1302+ yield [false ];
1303+ yield [true ];
1304+ }
1305+
1306+ public function testBug10245 (): void
1307+ {
1308+ $ this ->cliArgumentsVariablesRegistered = true ;
1309+ $ this ->polluteScopeWithLoopInitialAssignments = false ;
1310+ $ this ->checkMaybeUndefinedVariables = true ;
1311+ $ this ->polluteScopeWithAlwaysIterableForeach = true ;
1312+
1313+ $ this ->analyse ([__DIR__ . '/data/bug-10245.php ' ], []);
1314+ }
1315+
1316+ public function testBug5919 (): void
1317+ {
1318+ $ this ->cliArgumentsVariablesRegistered = true ;
1319+ $ this ->polluteScopeWithLoopInitialAssignments = false ;
1320+ $ this ->checkMaybeUndefinedVariables = true ;
1321+ $ this ->polluteScopeWithAlwaysIterableForeach = true ;
1322+
1323+ $ this ->analyse ([__DIR__ . '/data/bug-5919.php ' ], []);
1324+ }
1325+
1326+ public function testBug5477 (): void
1327+ {
1328+ $ this ->cliArgumentsVariablesRegistered = true ;
1329+ $ this ->polluteScopeWithLoopInitialAssignments = false ;
1330+ $ this ->checkMaybeUndefinedVariables = true ;
1331+ $ this ->polluteScopeWithAlwaysIterableForeach = true ;
1332+
1333+ $ this ->analyse ([__DIR__ . '/data/bug-5477.php ' ], []);
1334+ }
1335+
12601336}
0 commit comments