,error_levels?:string[]}> */ public function providerValidCodeParse() { return [ 'getClassConstArg' => [ 'fooFoo(); break; case B::class: $a->barBar(); break; }', ], 'getClassExteriorArgClassConsts' => [ 'getMessage(); break; case LogicException::class: $e->getMessage(); break; } } ', ], 'switchGetClassVar' => [ 'foo(); break; } }', ], 'getTypeArg' => [ ' [ 'a !== null: return $obj->a; // definitely not null case !is_null($obj->b): return $obj->b; // definitely not null default: throw new \InvalidArgumentException("$obj->a or $obj->b must be set"); } }', ], 'switchMoTruthy' => [ 'a: return $obj->a; // definitely not null case $obj->b: return $obj->b; // definitely not null default: throw new \InvalidArgumentException("$obj->a or $obj->b must be set"); } }', ], 'switchWithBadBreak' => [ ' [ ' [ ' [ '$x' => 'bool', '$y' => 'bool', ], ], 'continueIsBreak' => [ ' [ ' [ 'maybeReturnsDT(); if (!is_null($dt)) { $dt = $dt->format(\DateTime::ISO8601); } break; } class A { public function maybeReturnsDT(): ?\DateTimeInterface { return rand(0,1) ? new \DateTime("now") : null; } }', ], 'issetInFallthrough' => [ ' 2) { echo "$x is large"; } break; } }', ], 'switchManyGetClass' => [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ '$a' => 'bool', '$b' => 'int', ], ], 'switchVarConditionalReAssignment' => [ ' [ '$a' => 'bool', ], ], 'moreThan30Cases' => [ ' */ public function providerInvalidCodeParse() { return [ 'switchReturnTypeWithFallthroughAndBreak' => [ ' 'InvalidNullableReturnType', ], 'switchReturnTypeWithFallthroughAndConditionalBreak' => [ ' 'InvalidNullableReturnType', ], 'switchReturnTypeWithNoDefault' => [ ' 'InvalidNullableReturnType', ], 'getClassArgWrongClass' => [ 'barBar(); break; }', 'error_message' => 'UndefinedMethod', ], 'getClassMissingClass' => [ ' 'UndefinedClass', ], 'getTypeNotAType' => [ ' 'UnevaluatedCode', ], 'getTypeArgWrongArgs' => [ ' 'InvalidScalarArgument', ], 'switchBadMethodCallInCase' => [ ' 'InvalidScalarArgument', ], 'continueIsNotBreak' => [ ' 'ContinueOutsideLoop', ], 'defaultAboveCaseThatBreaks' => [ ' 'InvalidReturnType', ], 'SKIPPED-switchManyGetClassWithRepetitionWithProperLineNumber' => [ ' 'RedundantCondition - src/somefile.php:10', 'error_levels' => ['ParadoxicalCondition'], ], 'repeatedCaseValue' => [ ' 'ParadoxicalCondition - src' . DIRECTORY_SEPARATOR . 'somefile.php:7', ], 'impossibleCaseValue' => [ ' 'TypeDoesNotContainType - src' . DIRECTORY_SEPARATOR . 'somefile.php:11', ], 'impossibleCaseDefault' => [ ' 'ParadoxicalCondition - src' . DIRECTORY_SEPARATOR . 'somefile.php:11', ], 'breakWithoutSettingVar' => [ ' 'PossiblyUndefinedVariable', ], 'getClassExteriorArgStringType' => [ 'getMessage(); break; } }', 'error_message' => 'TypeDoesNotContainType - src' . DIRECTORY_SEPARATOR . 'somefile.php:5:34 - string(InvalidArgumentException) cannot be identical to class-string', ], ]; } }