,error_levels?:string[]}> */ public function providerValidCodeParse(): iterable { return [ 'switchTruthy' => [ 'a !== null => $obj->a, $obj->b !== null => $obj->b, default => throw new \InvalidArgumentException("$obj->a or $obj->b must be set"), }; }', [], [], '8.0' ], 'defaultAboveCase' => [ ' "hello", default => "yellow", "b" => "goodbye", }; }', [], [], '8.0' ], 'allMatchedNoRedundantCondition' => [ ' "hello", "b" => "goodbye", }; }', [], [], '8.0' ], 'getClassWithMethod' => [ ' $value->hello(), default => "b", }; }', [], [], '8.0' ], ]; } /** * @return iterable */ public function providerInvalidCodeParse(): iterable { return [ 'getClassArgWrongClass' => [ ' $a->barBar(), };', 'error_message' => 'UndefinedMethod', [], false, '8.0' ], 'getClassMissingClass' => [ ' 5, };', 'error_message' => 'UndefinedClass', [], false, '8.0' ], 'allMatchedDefaultImpossible' => [ ' "hello", "b" => "goodbye", default => "impossible", }; }', 'error_message' => 'TypeDoesNotContainType', [], false, '8.0' ], 'allMatchedAnotherImpossible' => [ ' "hello", "b" => "goodbye", "c" => "impossible", }; }', 'error_message' => 'TypeDoesNotContainType', [], false, '8.0' ], 'notAllEnumsMet' => [ ' "foo", }; }', 'error_message' => 'UnhandledMatchCondition', [], false, '8.0', ], 'notAllConstEnumsMet' => [ ' "John F Kennedy Airport", self::LHR => "London Heathrow", }; } }', 'error_message' => 'UnhandledMatchCondition', [], false, '8.0', ], 'paradoxWithDuplicateValue' => [ ' 0, 1 => 1, }; };', 'error_message' => 'ParadoxicalCondition', [], false, '8.0', ], 'noCrashWithEmptyMatch' => [ ' 'UnhandledMatchCondition', [], false, '8.0', ], 'exitIsLikeThrow' => [ ' exit(), 2, 3 => $i, }; $a === "aaa"; }', 'error_message' => 'DocblockTypeContradiction', [], false, '8.0', ], 'matchTrueImpossible' => [ ' 1, $foo instanceof \Exception => 1, };', 'error_message' => 'TypeDoesNotContainType', [], false, '8.0', ], ]; } }