[ 'code' => 'a !== null => $obj->a, $obj->b !== null => $obj->b, default => throw new \InvalidArgumentException("$obj->a or $obj->b must be set"), }; }', 'assertions' => [], 'ignored_issues' => [], 'php_version' => '8.0', ], 'defaultAboveCase' => [ 'code' => ' "hello", default => "yellow", "b" => "goodbye", }; }', 'assertions' => [], 'ignored_issues' => [], 'php_version' => '8.0', ], 'allMatchedNoRedundantCondition' => [ 'code' => ' "hello", "b" => "goodbye", }; }', 'assertions' => [], 'ignored_issues' => [], 'php_version' => '8.0', ], 'getClassWithMethod' => [ 'code' => ' $value->hello(), default => "b", }; }', 'assertions' => [], 'ignored_issues' => [], 'php_version' => '8.0', ], 'MatchWithCount' => [ 'code' => ' throw new \InvalidArgumentException, default => $array, }; }', 'assertions' => [], 'ignored_issues' => [], 'php_version' => '8.1', ], 'multipleIdenticalChecksInOneArm' => [ 'code' => ' "1 or 2 or 3", "type4", "type5", "type6" => "4 or 5 or 6", default => "rest", }; }', 'assertions' => [], 'ignored_issues' => [], 'php_version' => '8.1', ], 'multipleInstanceOfConditionsInOneArm' => [ 'code' => ' baz($foo), $foo instanceof C => 3, default => 0, }; }', 'assertions' => [], 'ignored_issues' => [], 'php_version' => '8.0', ], 'multipleTypeCheckConditionsInOneArm' => [ 'code' => ' baz($foo), default => 0, }; }', 'assertions' => [], 'ignored_issues' => [], 'php_version' => '8.0', ], 'matchOnConstClassFetch' => [ 'code' => ' $obj->propFromObj1, Obj2::class => $obj->propFromObj2, }; }', 'assertions' => [], 'ignored_issues' => [], 'php_version' => '8.0', ], ]; } public function providerInvalidCodeParse(): iterable { return [ 'getClassArgWrongClass' => [ 'code' => ' $a->barBar(), };', 'error_message' => 'UndefinedMethod', 'ignored_issues' => [], 'php_version' => '8.0', ], 'getClassMissingClass' => [ 'code' => ' 5, };', 'error_message' => 'UndefinedClass', 'ignored_issues' => [], 'php_version' => '8.0', ], 'allMatchedDefaultImpossible' => [ 'code' => ' "hello", "b" => "goodbye", default => "impossible", }; }', 'error_message' => 'TypeDoesNotContainType', 'ignored_issues' => [], 'php_version' => '8.0', ], 'allMatchedAnotherImpossible' => [ 'code' => ' "hello", "b" => "goodbye", "c" => "impossible", }; }', 'error_message' => 'TypeDoesNotContainType', 'ignored_issues' => [], 'php_version' => '8.0', ], 'notAllEnumsMet' => [ 'code' => ' "foo", }; }', 'error_message' => 'UnhandledMatchCondition', 'ignored_issues' => [], 'php_version' => '8.0', ], 'notAllConstEnumsMet' => [ 'code' => ' "John F Kennedy Airport", self::LHR => "London Heathrow", }; } }', 'error_message' => 'UnhandledMatchCondition', 'ignored_issues' => [], 'php_version' => '8.0', ], 'paradoxWithDuplicateValue' => [ 'code' => ' 0, 1 => 1, }; };', 'error_message' => 'ParadoxicalCondition', 'ignored_issues' => [], 'php_version' => '8.0', ], 'noCrashWithEmptyMatch' => [ 'code' => ' 'UnhandledMatchCondition', 'ignored_issues' => [], 'php_version' => '8.0', ], 'exitIsLikeThrow' => [ 'code' => ' exit(), 2, 3 => $i, }; $a === "aaa"; }', 'error_message' => 'DocblockTypeContradiction', 'ignored_issues' => [], 'php_version' => '8.0', ], 'matchTrueImpossible' => [ 'code' => ' 1, $foo instanceof \Exception => 1, };', 'error_message' => 'TypeDoesNotContainType', 'ignored_issues' => [], 'php_version' => '8.0', ], 'multipleInstanceOfConditionsNotMetInOneArm' => [ 'code' => ' baz($foo), $foo instanceof C => 3, default => 0, }; }', 'error_message' => 'InvalidArgument', 'ignored_issues' => [], 'php_version' => '8.0', ], ]; } }