markTestSkipped('Cannot run test, base class "mysqli" does not exist!'); return; } $this->addFile( 'somefile.php', ',error_levels?:string[]}> */ public function providerValidCodeParse(): iterable { return [ 'overrideProtectedAccessLevelToPublic' => [ ' [ ' [ ' [ 'foo(); } }', ], 'missingParentWithFunction' => [ ' [], 'error_levels' => [ 'UndefinedClass', 'MissingReturnType', ], ], 'subclassWithSimplerArg' => [ ' [ ' [ ' [ '$object' => 'Bar|Foo', ], ], 'instantiateClassAndIsA' => [ 'bar(); }', ], 'returnStringAfterIsACheckWithClassConst' => [ ' [ ' [ ' $array */ function foo(array $array, string $key) : void { foreach ($array as $i => $item) { $array[$key] = new class() {}; if ($array[$i] === $array[$key]) {} } }', ], 'getClassSelfClass' => [ 'baz(); } return ""; } public function baz(): string { return "baz"; } }', ], 'staticClassComparison' => [ 'baz(); } return ""; } public static function foo2(): string { if (static::class === D::class) { return static::bat(); } return ""; } } class D extends C { public function baz(): string { return "baz"; } public static function bat(): string { return "baz"; } }', ], 'isAStaticClass' => [ 'baz(); } return ""; } public static function foo2(): string { if (is_a(static::class, D::class, true)) { return static::bat(); } return ""; } } class D extends C { public function baz(): string { return "baz"; } public static function bat(): string { return "baz"; } }', ], 'typedMagicCall' => [ 'zugzug(); $b = (new A)->bar()->baz();', 'assertions' => [ '$a' => 'B', '$b' => 'string', ], ], 'abstractCallToInterfaceMethod' => [ 'fooBar(); } }', ], 'noCrashWhenIgnoringUndefinedClass' => [ ' [], 'error_levels' => [ 'UndefinedClass', ], ], 'noCrashWhenIgnoringUndefinedParam' => [ ' [], 'error_levels' => [ 'UndefinedClass', 'InvalidArgument', ], ], 'noCrashWhenIgnoringUndefinedReturnIterableArg' => [ ' [], 'error_levels' => [ 'UndefinedClass', 'MixedInferredReturnType', 'InvalidArgument', ], ], 'noCrashWhenIgnoringUndefinedReturnClassArg' => [ ' [], 'error_levels' => [ 'UndefinedClass', 'MixedInferredReturnType', 'InvalidArgument', ], ], 'allowAbstractInstantiationOnPossibleChild' => [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ 'mock(); return $b; }' ], ]; } /** * @return iterable */ public function providerInvalidCodeParse(): iterable { return [ 'undefinedClass' => [ ' 'UndefinedClass', ], 'wrongCaseClass' => [ ' 'InvalidClass', ], 'wrongCaseClassWithCall' => [ ' 'InvalidClass', ], 'invalidThisFetch' => [ ' 'InvalidScope', ], 'invalidThisArgument' => [ ' 'InvalidScope', ], 'undefinedConstant' => [ ' 'UndefinedConstant', ], 'undefinedClassConstant' => [ ' 'UndefinedConstant', ], 'overridePublicAccessLevelToPrivate' => [ ' 'OverriddenMethodAccess', ], 'overridePublicAccessLevelToProtected' => [ ' 'OverriddenMethodAccess', ], 'overrideProtectedAccessLevelToPrivate' => [ ' 'OverriddenMethodAccess', ], 'overridePublicPropertyAccessLevelToPrivate' => [ ' 'OverriddenPropertyAccess', ], 'overridePublicPropertyAccessLevelToProtected' => [ ' 'OverriddenPropertyAccess', ], 'overrideProtectedPropertyAccessLevelToPrivate' => [ ' 'OverriddenPropertyAccess', ], 'classRedefinition' => [ ' 'DuplicateClass', ], 'classRedefinitionInNamespace' => [ ' 'DuplicateClass', ], 'classRedefinitionInSeparateNamespace' => [ ' 'DuplicateClass', ], 'abstractClassInstantiation' => [ ' 'AbstractInstantiation', ], 'abstractClassMethod' => [ ' 'UnimplementedAbstractMethod', ], 'abstractReflectedClassMethod' => [ ' 'UnimplementedAbstractMethod', ], 'missingParent' => [ ' 'UndefinedClass', ], 'lessSpecificReturnStatement' => [ ' 'LessSpecificReturnStatement', ], 'circularReference' => [ ' 'CircularReference', ], 'preventAbstractInstantiationDefiniteClasss' => [ ' 'AbstractInstantiation', ], 'preventExtendingInterface' => [ ' 'UndefinedClass', ], 'preventImplementingClass' => [ ' 'UndefinedInterface', ], 'classAliasAlreadyDefinedClass' => [ ' 'TypeDoesNotContainType', ], 'cannotOverrideFinalType' => [ ' 'MethodSignatureMismatch', ], 'preventFinalOverriding' => [ 'foo();', 'error_message' => 'LessSpecificReturnStatement', ], ]; } }