[ ' [ ' [ ' [ ' [ '$a' => 'int', '$b' => 'string', ], ], 'getClassConstantValue' => [ ' [ ' [], 'error_levels' => ['MixedArgument'], ], 'undefinedConstant' => [ ' [], 'error_levels' => ['UndefinedConstant'], ], 'suppressUndefinedClassConstant' => [ ' [], 'error_levels' => ['MixedAssignment'], ], 'hardToDefineClassConstant' => [ ' 4, "name" => 3 ]; const B = 4; } echo A::C[4];', ], 'sameNamedConstInOtherClass' => [ ' "one", ]; } echo A::C[4];', ], 'onlyMatchingConstantOffset' => [ ' 1, "two" => 2 ]; } foreach (A::KEYS as $key) { if (isset(A::ARR[$key])) { echo A::ARR[$key]; } }', ], 'noExceptionsOnMixedArrayKey' => [ ' A::class, "type2" => B::class, ]; public function bar(array $data): void { if (!isset(self::TYPES[$data["type"]])) { throw new \InvalidArgumentException("Unknown type"); } $class = self::TYPES[$data["type"]]; $ret = finder($data["id"]); if (!$ret || !$ret instanceof $class) { throw new \InvalidArgumentException; } } }', 'assertions' => [], 'error_levels' => ['MixedArgument', 'MixedArrayOffset', 'MixedAssignment'], ], ]; } /** * @return array */ public function providerFileCheckerInvalidCodeParse() { return [ 'constantDefinedInFunctionButNotCalled' => [ ' 'UndefinedConstant', ], 'undefinedClassConstantInParamDefault' => [ ' 'UndefinedConstant', ], 'nonMatchingConstantOffset' => [ ' 1, "two" => 2 ]; const ARR2 = [ "three" => 3, "four" => 4 ]; } foreach (A::KEYS as $key) { if (isset(A::ARR[$key])) { echo A::ARR2[$key]; } }', 'error_message' => 'InvalidArrayOffset', ], ]; } }