,error_levels?:string[]}> */ public function providerValidCodeParse(): iterable { return [ 'doWhileVar' => [ ' [ '$worked' => 'true', ], ], 'doWhileVarWithPossibleBreak' => [ ' [ '$a' => 'bool', ], ], 'SKIPPED-doWhileVarWithPossibleBreakThatSetsToTrue' => [ ' [ '$a' => 'true', '$b' => 'true', ], ], 'doWhileVarWithPossibleBreakThatMaybeSetsToTrue' => [ ' [ '$a' => 'bool', ], ], 'doWhileVarWithPossibleInitialisingBreakNoInitialDefinition' => [ ' [ '$worked' => 'true', ], ], 'doWhileUndefinedVar' => [ ' [ '$result' => 'true', ], ], 'doWhileVarAndBreak' => [ ' [ 'a = rand(0, 1) ? new A : null; } } function takesA(A $a): void {} $a = new A(); do { takesA($a); $a = $a->a; } while ($a);', 'assertions' => [ '$a' => 'null', ], ], 'doWhileWithMethodCall' => [ 'getParent(); } while ($a);', 'assertions' => [ '$a' => 'null', ], ], 'doWhileFirstGood' => [ ' 0; } while (!$done);', ], 'doWhileWithIfException' => [ 'parent === null) { throw new \Exception("bad"); } $a = $a->parent; } while (rand(0,1)); } }', ], 'doWhileWithIfExceptionOutside' => [ 'parent === null) { throw new \Exception("bad"); } do { $a = $a->parent; } while ($a->parent && rand(0, 1)); } }', ], 'doWhileDefinedVar' => [ ' [ ' [ ' [ 'getParent(); } while ($a !== false);', ], 'doCallInWhile' => [ 'getParent());', ], 'doWithContinue' => [ ' [ ' [ ' 0); echo $i === 0;', ], 'doWhileNonInfinite' => [ ' 5) continue; break; } while (true); return $value; }', ], 'doNoRedundant' => [ ' [ ' 'true' ] ], 'doConditionInWhileAndIfWithTwoVars' => [ ' [ ' [ ' */ public function providerInvalidCodeParse(): iterable { return [ 'doWhileVarWithPossibleBreakWithoutDefining' => [ ' 'PossiblyUndefinedGlobalVariable', ], 'doWhileVarWithPossibleBreakThatMaybeSetsToTrueWithoutDefining' => [ ' 'PossiblyUndefinedGlobalVariable', ], 'SKIPPED-doWhileVarWithPossibleContinueWithoutDefining' => [ ' 'PossiblyUndefinedGlobalVariable', ], 'possiblyUndefinedArrayInDo' => [ ' 'PossiblyUndefinedGlobalVariable - src' . DIRECTORY_SEPARATOR . 'somefile.php:3:25 - Possibly undefined ' . 'global variable $array, first seen on line 3', ], ]; } }