diff --git a/phpunit.xml b/phpunit.xml index b083450096..6e15cf3eea 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -14,16 +14,6 @@ beStrictAboutTodoAnnotatedTests="true" verbose="false" convertDeprecationsToExceptions="true"> - - - src - - - - - - - tests/PHPStan diff --git a/src/Fixable/Patcher.php b/src/Fixable/Patcher.php index 197a58b442..dcacfec92a 100644 --- a/src/Fixable/Patcher.php +++ b/src/Fixable/Patcher.php @@ -12,6 +12,7 @@ use PHPStan\File\FileReader; use ReflectionClass; use SebastianBergmann\Diff\Differ; +use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder; use function array_map; use function count; use function implode; @@ -29,7 +30,7 @@ final class Patcher public function __construct() { - $this->differ = new Differ(); + $this->differ = new Differ(new UnifiedDiffOutputBuilder()); } /** diff --git a/tests/PHPStan/Analyser/AnalyserIntegrationTest.php b/tests/PHPStan/Analyser/AnalyserIntegrationTest.php index f7f1c22648..a611443139 100644 --- a/tests/PHPStan/Analyser/AnalyserIntegrationTest.php +++ b/tests/PHPStan/Analyser/AnalyserIntegrationTest.php @@ -81,7 +81,7 @@ public function testExtendingKnownClassWithCheck(): void $errors = $this->runAnalyse(__DIR__ . '/data/extending-known-class-with-check.php'); $this->assertNoErrors($errors); - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $this->assertTrue($reflectionProvider->hasClass(Foo::class)); } @@ -372,7 +372,7 @@ public function testBug4713(): void $this->assertCount(1, $errors); $this->assertSame('Method Bug4713\Service::createInstance() should return Bug4713\Service but returns object.', $errors[0]->getMessage()); - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass(Service::class); $parameter = $class->getNativeMethod('createInstance')->getOnlyVariant()->getParameters()[0]; $defaultValue = $parameter->getDefaultValue(); @@ -385,7 +385,7 @@ public function testBug4288(): void $errors = $this->runAnalyse(__DIR__ . '/data/bug-4288.php'); $this->assertNoErrors($errors); - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass(MyClass::class); $parameter = $class->getNativeMethod('paginate')->getOnlyVariant()->getParameters()[0]; $defaultValue = $parameter->getDefaultValue(); diff --git a/tests/PHPStan/Analyser/AnalyserTest.php b/tests/PHPStan/Analyser/AnalyserTest.php index 8855ddd8f6..9348cd7b73 100644 --- a/tests/PHPStan/Analyser/AnalyserTest.php +++ b/tests/PHPStan/Analyser/AnalyserTest.php @@ -152,7 +152,7 @@ public function testIgnoreErrorMultiByPath(): void $this->assertNoErrors($result); } - public function dataIgnoreErrorByPathAndCount(): iterable + public static function dataIgnoreErrorByPathAndCount(): iterable { yield [ [ @@ -204,7 +204,7 @@ public function testIgnoreErrorByPathAndCount(array $ignoreErrors): void $this->assertNoErrors($result); } - public function dataTrueAndFalse(): array + public static function dataTrueAndFalse(): array { return [ [true], @@ -422,7 +422,7 @@ public function testIgnoreErrorNotFoundInPathExplicitReportUnmatched(): void $this->assertSame('Ignored error pattern #Fail\.# in path ' . __DIR__ . '/data/not-existent-path.php was not matched in reported errors.', $result[0]); } - public function dataIgnoreErrorInTraitUsingClassFilePath(): array + public static function dataIgnoreErrorInTraitUsingClassFilePath(): array { return [ [ @@ -672,7 +672,7 @@ private function runAnalyser( new IgnoreErrorExtensionProvider(new NetteContainer(new Container([]))), self::getContainer()->getByType(RuleErrorTransformer::class), $this->createScopeFactory( - $this->createReflectionProvider(), + self::createReflectionProvider(), self::getContainer()->getService('typeSpecifier'), ), new LocalIgnoresProcessor(), @@ -700,7 +700,7 @@ private function createAnalyser(): Analyser ]); $collectorRegistry = new CollectorRegistry([]); - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $fileHelper = $this->getFileHelper(); $typeSpecifier = self::getContainer()->getService('typeSpecifier'); diff --git a/tests/PHPStan/Analyser/AnonymousClassNameRuleTest.php b/tests/PHPStan/Analyser/AnonymousClassNameRuleTest.php index c5f5a5aab1..ab344177ba 100644 --- a/tests/PHPStan/Analyser/AnonymousClassNameRuleTest.php +++ b/tests/PHPStan/Analyser/AnonymousClassNameRuleTest.php @@ -10,7 +10,7 @@ class AnonymousClassNameRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new AnonymousClassNameRule($reflectionProvider); } diff --git a/tests/PHPStan/Analyser/ArgumentsNormalizerTest.php b/tests/PHPStan/Analyser/ArgumentsNormalizerTest.php index 329b84522c..184d3aba8c 100644 --- a/tests/PHPStan/Analyser/ArgumentsNormalizerTest.php +++ b/tests/PHPStan/Analyser/ArgumentsNormalizerTest.php @@ -22,7 +22,7 @@ class ArgumentsNormalizerTest extends PHPStanTestCase { - public function dataReorderValid(): iterable + public static function dataReorderValid(): iterable { yield [ [ @@ -298,7 +298,7 @@ public function testReorderValid( } } - public function dataReorderInvalid(): iterable + public static function dataReorderInvalid(): iterable { yield [ [ diff --git a/tests/PHPStan/Analyser/AssertStubTest.php b/tests/PHPStan/Analyser/AssertStubTest.php index 2ea24ac4ce..b4df473245 100644 --- a/tests/PHPStan/Analyser/AssertStubTest.php +++ b/tests/PHPStan/Analyser/AssertStubTest.php @@ -7,9 +7,9 @@ class AssertStubTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/assert-stub.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/assert-stub.php'); } /** diff --git a/tests/PHPStan/Analyser/Bug10922Test.php b/tests/PHPStan/Analyser/Bug10922Test.php index 2dccf946c8..d1a27e11c8 100644 --- a/tests/PHPStan/Analyser/Bug10922Test.php +++ b/tests/PHPStan/Analyser/Bug10922Test.php @@ -7,9 +7,9 @@ class Bug10922Test extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-10922.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/bug-10922.php'); } /** diff --git a/tests/PHPStan/Analyser/Bug10980Test.php b/tests/PHPStan/Analyser/Bug10980Test.php index 6c3821447f..fc7bea417c 100644 --- a/tests/PHPStan/Analyser/Bug10980Test.php +++ b/tests/PHPStan/Analyser/Bug10980Test.php @@ -7,7 +7,7 @@ class Bug10980Test extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { yield from self::gatherAssertTypes(__DIR__ . '/data/bug-10980.php'); } diff --git a/tests/PHPStan/Analyser/Bug11009Test.php b/tests/PHPStan/Analyser/Bug11009Test.php index 480e170756..23a3c0b256 100644 --- a/tests/PHPStan/Analyser/Bug11009Test.php +++ b/tests/PHPStan/Analyser/Bug11009Test.php @@ -7,9 +7,9 @@ class Bug11009Test extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-11009.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/bug-11009.php'); } /** diff --git a/tests/PHPStan/Analyser/Bug9307CallMethodsRuleTest.php b/tests/PHPStan/Analyser/Bug9307CallMethodsRuleTest.php index 278e2d805d..a7342e7506 100644 --- a/tests/PHPStan/Analyser/Bug9307CallMethodsRuleTest.php +++ b/tests/PHPStan/Analyser/Bug9307CallMethodsRuleTest.php @@ -20,7 +20,7 @@ class Bug9307CallMethodsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $ruleLevelHelper = new RuleLevelHelper($reflectionProvider, true, false, true, true, false, false, true); return new CallMethodsRule( new MethodCallCheck($reflectionProvider, $ruleLevelHelper, true, true), diff --git a/tests/PHPStan/Analyser/Bug9307Test.php b/tests/PHPStan/Analyser/Bug9307Test.php index 6502ac2701..f1dcf78745 100644 --- a/tests/PHPStan/Analyser/Bug9307Test.php +++ b/tests/PHPStan/Analyser/Bug9307Test.php @@ -7,9 +7,9 @@ class Bug9307Test extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-9307.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/bug-9307.php'); } /** diff --git a/tests/PHPStan/Analyser/ClassConstantStubFileTest.php b/tests/PHPStan/Analyser/ClassConstantStubFileTest.php index 00d83693e6..a2f8930f99 100644 --- a/tests/PHPStan/Analyser/ClassConstantStubFileTest.php +++ b/tests/PHPStan/Analyser/ClassConstantStubFileTest.php @@ -7,9 +7,9 @@ class ClassConstantStubFileTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/class-constant-stub-files.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/class-constant-stub-files.php'); } /** diff --git a/tests/PHPStan/Analyser/ConditionalReturnTypeFromMethodStubTest.php b/tests/PHPStan/Analyser/ConditionalReturnTypeFromMethodStubTest.php index 84be755a38..97a3683dd4 100644 --- a/tests/PHPStan/Analyser/ConditionalReturnTypeFromMethodStubTest.php +++ b/tests/PHPStan/Analyser/ConditionalReturnTypeFromMethodStubTest.php @@ -7,9 +7,9 @@ class ConditionalReturnTypeFromMethodStubTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/conditional-return-type-stub.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/conditional-return-type-stub.php'); } /** diff --git a/tests/PHPStan/Analyser/DoNotPolluteScopeWithBlockTest.php b/tests/PHPStan/Analyser/DoNotPolluteScopeWithBlockTest.php index cd4ceb5d85..4e2e6063e0 100644 --- a/tests/PHPStan/Analyser/DoNotPolluteScopeWithBlockTest.php +++ b/tests/PHPStan/Analyser/DoNotPolluteScopeWithBlockTest.php @@ -7,9 +7,9 @@ class DoNotPolluteScopeWithBlockTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/do-not-pollute-scope-with-block.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/do-not-pollute-scope-with-block.php'); } /** diff --git a/tests/PHPStan/Analyser/DoNotRememberPossiblyImpureFunctionValuesTest.php b/tests/PHPStan/Analyser/DoNotRememberPossiblyImpureFunctionValuesTest.php index 61c93088f9..9ed49ed42b 100644 --- a/tests/PHPStan/Analyser/DoNotRememberPossiblyImpureFunctionValuesTest.php +++ b/tests/PHPStan/Analyser/DoNotRememberPossiblyImpureFunctionValuesTest.php @@ -7,9 +7,9 @@ class DoNotRememberPossiblyImpureFunctionValuesTest extends TypeInferenceTestCase { - public function dataAsserts(): iterable + public static function dataAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/do-not-remember-possibly-impure-function-values.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/do-not-remember-possibly-impure-function-values.php'); } /** diff --git a/tests/PHPStan/Analyser/DynamicMethodThrowTypeExtensionTest.php b/tests/PHPStan/Analyser/DynamicMethodThrowTypeExtensionTest.php index 0d5f8a8dc8..9ae0f4ad22 100644 --- a/tests/PHPStan/Analyser/DynamicMethodThrowTypeExtensionTest.php +++ b/tests/PHPStan/Analyser/DynamicMethodThrowTypeExtensionTest.php @@ -8,14 +8,14 @@ class DynamicMethodThrowTypeExtensionTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { if (PHP_VERSION_ID < 80000) { return []; } - yield from $this->gatherAssertTypes(__DIR__ . '/data/dynamic-method-throw-type-extension.php'); - yield from $this->gatherAssertTypes(__DIR__ . '/data/dynamic-method-throw-type-extension-named-args-fixture.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/dynamic-method-throw-type-extension.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/dynamic-method-throw-type-extension-named-args-fixture.php'); } /** diff --git a/tests/PHPStan/Analyser/DynamicReturnTypeExtensionTypeInferenceTest.php b/tests/PHPStan/Analyser/DynamicReturnTypeExtensionTypeInferenceTest.php index 7e5fad5dda..481a6c24ca 100644 --- a/tests/PHPStan/Analyser/DynamicReturnTypeExtensionTypeInferenceTest.php +++ b/tests/PHPStan/Analyser/DynamicReturnTypeExtensionTypeInferenceTest.php @@ -8,17 +8,17 @@ class DynamicReturnTypeExtensionTypeInferenceTest extends TypeInferenceTestCase { - public function dataAsserts(): iterable + public static function dataAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-types.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-types.php'); if (PHP_VERSION_ID >= 80000) { - yield from $this->gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-types-named-args.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-types-named-args.php'); } - yield from $this->gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-compound-types.php'); - yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-7344.php'); - yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-7391b.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-compound-types.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/bug-7344.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/bug-7391b.php'); } /** diff --git a/tests/PHPStan/Analyser/ErrorTest.php b/tests/PHPStan/Analyser/ErrorTest.php index 7bd49a242a..0ec0b8bf36 100644 --- a/tests/PHPStan/Analyser/ErrorTest.php +++ b/tests/PHPStan/Analyser/ErrorTest.php @@ -15,7 +15,7 @@ public function testError(): void $this->assertSame(10, $error->getLine()); } - public function dataValidIdentifier(): iterable + public static function dataValidIdentifier(): iterable { yield ['a']; yield ['aa']; @@ -37,7 +37,7 @@ public function testValidIdentifier(string $identifier): void $this->assertTrue(Error::validateIdentifier($identifier)); } - public function dataInvalidIdentifier(): iterable + public static function dataInvalidIdentifier(): iterable { yield ['']; yield [' ']; diff --git a/tests/PHPStan/Analyser/ExpressionTypeResolverExtensionTest.php b/tests/PHPStan/Analyser/ExpressionTypeResolverExtensionTest.php index b8dda807d4..22169d7158 100644 --- a/tests/PHPStan/Analyser/ExpressionTypeResolverExtensionTest.php +++ b/tests/PHPStan/Analyser/ExpressionTypeResolverExtensionTest.php @@ -7,7 +7,7 @@ class ExpressionTypeResolverExtensionTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { yield from self::gatherAssertTypes(__DIR__ . '/data/expression-type-resolver-extension.php'); } diff --git a/tests/PHPStan/Analyser/Ignore/IgnoreLexerTest.php b/tests/PHPStan/Analyser/Ignore/IgnoreLexerTest.php index 168b6799b1..f4aa27f5c3 100644 --- a/tests/PHPStan/Analyser/Ignore/IgnoreLexerTest.php +++ b/tests/PHPStan/Analyser/Ignore/IgnoreLexerTest.php @@ -10,7 +10,7 @@ class IgnoreLexerTest extends PHPStanTestCase { - public function dataTokenize(): iterable + public static function dataTokenize(): iterable { yield [ '', diff --git a/tests/PHPStan/Analyser/ImmediatelyCalledFunctionWithoutImplicitThrowTest.php b/tests/PHPStan/Analyser/ImmediatelyCalledFunctionWithoutImplicitThrowTest.php index f810ed04a2..b182b1bea4 100644 --- a/tests/PHPStan/Analyser/ImmediatelyCalledFunctionWithoutImplicitThrowTest.php +++ b/tests/PHPStan/Analyser/ImmediatelyCalledFunctionWithoutImplicitThrowTest.php @@ -8,9 +8,9 @@ class ImmediatelyCalledFunctionWithoutImplicitThrowTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/immediately-called-function-without-implicit-throw.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/immediately-called-function-without-implicit-throw.php'); } /** diff --git a/tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php b/tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php index 167cad5f8e..ba4c419352 100644 --- a/tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php @@ -63,10 +63,10 @@ public function testClassMethodScope(): void }); } - private function getFileScope(string $filename): Scope + private static function getFileScope(string $filename): Scope { $testScope = null; - $this->processFile($filename, static function (Node $node, Scope $scope) use (&$testScope): void { + self::processFile($filename, static function (Node $node, Scope $scope) use (&$testScope): void { if (!($node instanceof Exit_)) { return; } @@ -78,7 +78,7 @@ private function getFileScope(string $filename): Scope return $testScope; } - public function dataUnionInCatch(): array + public static function dataUnionInCatch(): array { return [ [ @@ -103,7 +103,7 @@ public function testUnionInCatch( ); } - public function dataUnionAndIntersection(): array + public static function dataUnionAndIntersection(): array { return [ [ @@ -228,9 +228,9 @@ public function testUnionAndIntersection( ); } - public function dataAssignInIf(): array + public static function dataAssignInIf(): array { - $testScope = $this->getFileScope(__DIR__ . '/data/if.php'); + $testScope = self::getFileScope(__DIR__ . '/data/if.php'); return [ [ @@ -758,9 +758,9 @@ public function testAssignInIf( ); } - public function dataConstantTypes(): array + public static function dataConstantTypes(): array { - $testScope = $this->getFileScope(__DIR__ . '/data/constantTypes.php'); + $testScope = self::getFileScope(__DIR__ . '/data/constantTypes.php'); return [ [ @@ -941,7 +941,7 @@ private function assertVariables( } } - public function dataArrayDestructuring(): array + public static function dataArrayDestructuring(): array { return [ [ @@ -1226,7 +1226,7 @@ public function testArrayDestructuring( ); } - public function dataParameterTypes(): array + public static function dataParameterTypes(): array { return [ [ @@ -1307,7 +1307,7 @@ public function testTypehints( ); } - public function dataAnonymousFunctionParameterTypes(): array + public static function dataAnonymousFunctionParameterTypes(): array { return [ [ @@ -1368,7 +1368,7 @@ public function testAnonymousFunctionTypehints( ); } - public function dataVarAnnotations(): array + public static function dataVarAnnotations(): array { return [ [ @@ -1452,7 +1452,7 @@ public function testVarAnnotations( ); } - public function dataCasts(): array + public static function dataCasts(): array { return [ [ @@ -1605,7 +1605,7 @@ public function testCasts( ); } - public function dataDeductedTypes(): array + public static function dataDeductedTypes(): array { return [ [ @@ -1735,7 +1735,7 @@ public function testDeductedTypes( ); } - public function dataProperties(): array + public static function dataProperties(): array { return [ [ @@ -1880,7 +1880,7 @@ public function testProperties( ); } - public function dataBinaryOperations(): array + public static function dataBinaryOperations(): array { $typeCallback = static function ($value): string { if (is_int($value)) { @@ -3197,7 +3197,7 @@ public function testBinaryOperations( ); } - public function dataVarStatementAnnotation(): array + public static function dataVarStatementAnnotation(): array { return [ [ @@ -3222,7 +3222,7 @@ public function testVarStatementAnnotation( ); } - public function dataCloneOperators(): array + public static function dataCloneOperators(): array { return [ [ @@ -3247,7 +3247,7 @@ public function testCloneOperators( ); } - public function dataLiteralArrays(): array + public static function dataLiteralArrays(): array { return [ [ @@ -3300,7 +3300,7 @@ public function testLiteralArrays( ); } - public function dataLiteralArraysKeys(): array + public static function dataLiteralArraysKeys(): array { define('STRING_ONE', '1'); define('INT_ONE', 1); @@ -3378,7 +3378,7 @@ public function testLiteralArraysKeys( ); } - public function dataStringArrayAccess(): array + public static function dataStringArrayAccess(): array { return [ [ @@ -3419,7 +3419,7 @@ public function testStringArrayAccess( ); } - public function dataTypeFromFunctionPhpDocs(): array + public static function dataTypeFromFunctionPhpDocs(): array { return [ [ @@ -3565,7 +3565,7 @@ public function dataTypeFromFunctionPhpDocs(): array ]; } - public function dataTypeFromFunctionFunctionPhpDocs(): array + public static function dataTypeFromFunctionFunctionPhpDocs(): array { return [ [ @@ -3596,7 +3596,7 @@ public function testTypeFromFunctionPhpDocs( ); } - public function dataTypeFromFunctionPrefixedPhpDocs(): array + public static function dataTypeFromFunctionPrefixedPhpDocs(): array { return [ [ @@ -3657,7 +3657,7 @@ public function testTypeFromFunctionPhpDocsPhanPrefix( ); } - public function dataTypeFromMethodPhpDocs(): array + public static function dataTypeFromMethodPhpDocs(): array { return [ [ @@ -3966,7 +3966,7 @@ public function testTypeFromRecursiveTraitPhpDocs( ); } - public function dataTypeFromTraitPhpDocsInSameFile(): array + public static function dataTypeFromTraitPhpDocsInSameFile(): array { return [ [ @@ -4050,7 +4050,7 @@ public function testNotSwitchInstanceof(): void ); } - public function dataSwitchInstanceOf(): array + public static function dataSwitchInstanceOf(): array { return [ [ @@ -4098,7 +4098,7 @@ public function testSwitchInstanceofTruthy( ); } - public function dataSwitchGetClass(): array + public static function dataSwitchGetClass(): array { return [ [ @@ -4131,7 +4131,7 @@ public function testSwitchGetClass( ); } - public function dataSwitchInstanceOfFallthrough(): array + public static function dataSwitchInstanceOfFallthrough(): array { return [ [ @@ -4156,7 +4156,7 @@ public function testSwitchInstanceOfFallthrough( ); } - public function dataSwitchTypeElimination(): array + public static function dataSwitchTypeElimination(): array { return [ [ @@ -4181,7 +4181,7 @@ public function testSwitchTypeElimination( ); } - public function dataOverwritingVariable(): array + public static function dataOverwritingVariable(): array { return [ [ @@ -4219,7 +4219,7 @@ public function testOverwritingVariable( ); } - public function dataNegatedInstanceof(): array + public static function dataNegatedInstanceof(): array { return [ [ @@ -4284,7 +4284,7 @@ public function testNegatedInstanceof( ); } - public function dataAnonymousFunction(): array + public static function dataAnonymousFunction(): array { return [ [ @@ -4321,7 +4321,7 @@ public function testAnonymousFunction( ); } - public function dataForeachArrayType(): array + public static function dataForeachArrayType(): array { return [ [ @@ -4458,7 +4458,7 @@ public function testForeachArrayType( ); } - public function dataOverridingSpecifiedType(): array + public static function dataOverridingSpecifiedType(): array { return [ [ @@ -4485,7 +4485,7 @@ public function testOverridingSpecifiedType( ); } - public function dataForeachObjectType(): array + public static function dataForeachObjectType(): array { return [ [ @@ -4545,7 +4545,7 @@ public function testForeachObjectType( ); } - public function dataArrayFunctions(): array + public static function dataArrayFunctions(): array { return [ [ @@ -5271,7 +5271,7 @@ public function testArrayFunctions( ); } - public function dataFunctions(): array + public static function dataFunctions(): array { $strSplitDefaultReturnType = 'non-empty-list|false'; if (PHP_VERSION_ID >= 80000) { @@ -5649,7 +5649,7 @@ public function testFunctions( ); } - public function dataDioFunctions(): array + public static function dataDioFunctions(): array { return [ [ @@ -5677,7 +5677,7 @@ public function testDioFunctions( ); } - public function dataSsh2Functions(): array + public static function dataSsh2Functions(): array { return [ [ @@ -5702,7 +5702,7 @@ public function testSsh2Functions( ); } - public function dataRangeFunction(): array + public static function dataRangeFunction(): array { return [ [ @@ -5775,7 +5775,7 @@ public function testRangeFunction( ); } - public function dataSpecifiedTypesUsingIsFunctions(): array + public static function dataSpecifiedTypesUsingIsFunctions(): array { return [ [ @@ -5932,7 +5932,7 @@ public function testSpecifiedTypesUsingIsFunctions( ); } - public function dataIterable(): array + public static function dataIterable(): array { return [ [ @@ -6097,7 +6097,7 @@ public function testIterable( ); } - public function dataArrayAccess(): array + public static function dataArrayAccess(): array { return [ [ @@ -6134,7 +6134,7 @@ public function testArrayAccess( ); } - public function dataVoid(): array + public static function dataVoid(): array { return [ [ @@ -6167,7 +6167,7 @@ public function testVoid( ); } - public function dataNullableReturnTypes(): array + public static function dataNullableReturnTypes(): array { return [ [ @@ -6204,7 +6204,7 @@ public function testNullableReturnTypes( ); } - public function dataTernary(): array + public static function dataTernary(): array { return [ [ @@ -6249,7 +6249,7 @@ public function testTernary( ); } - public function dataHeredoc(): array + public static function dataHeredoc(): array { return [ [ @@ -6278,7 +6278,7 @@ public function testHeredoc( ); } - public function dataTypeElimination(): array + public static function dataTypeElimination(): array { return [ [ @@ -6451,7 +6451,7 @@ public function testTypeElimination( ); } - public function dataMisleadingTypes(): array + public static function dataMisleadingTypes(): array { return [ [ @@ -6484,7 +6484,7 @@ public function testMisleadingTypes( ); } - public function dataMisleadingTypesWithoutNamespace(): array + public static function dataMisleadingTypesWithoutNamespace(): array { return [ [ @@ -6513,7 +6513,7 @@ public function testMisleadingTypesWithoutNamespace( ); } - public function dataUnresolvableTypes(): array + public static function dataUnresolvableTypes(): array { return [ [ @@ -6546,7 +6546,7 @@ public function testUnresolvableTypes( ); } - public function dataCombineTypes(): array + public static function dataCombineTypes(): array { return [ [ @@ -6575,7 +6575,7 @@ public function testCombineTypes( ); } - public function dataConstants(): array + public static function dataConstants(): array { define('ConstantsForNodeScopeResolverTest\\FOO_CONSTANT', 1); @@ -6614,7 +6614,7 @@ public function testConstants( ); } - public function dataFinally(): array + public static function dataFinally(): array { return [ [ @@ -6658,7 +6658,7 @@ public function testFinallyWithEarlyTermination( ); } - public function dataInheritDocFromInterface(): array + public static function dataInheritDocFromInterface(): array { return [ [ @@ -6698,7 +6698,7 @@ public function testInheritDocWithoutCurlyBracesFromInterface( ); } - public function dataInheritDocFromInterface2(): array + public static function dataInheritDocFromInterface2(): array { return [ [ @@ -6740,7 +6740,7 @@ public function testInheritDocWithoutCurlyBracesFromInterface2( ); } - public function dataInheritDocFromTrait(): array + public static function dataInheritDocFromTrait(): array { return [ [ @@ -6780,7 +6780,7 @@ public function testInheritDocWithoutCurlyBracesFromTrait( ); } - public function dataInheritDocFromTrait2(): array + public static function dataInheritDocFromTrait2(): array { return [ [ @@ -6824,7 +6824,7 @@ public function testInheritDocWithoutCurlyBracesFromTrait2( ); } - public function dataResolveStatic(): array + public static function dataResolveStatic(): array { return [ [ @@ -6865,7 +6865,7 @@ public function testResolveStatic( ); } - public function dataLoopVariables(): array + public static function dataLoopVariables(): array { return [ [ @@ -6911,7 +6911,7 @@ public function dataLoopVariables(): array ]; } - public function dataForeachLoopVariables(): array + public static function dataForeachLoopVariables(): array { return [ [ @@ -7007,7 +7007,7 @@ public function dataForeachLoopVariables(): array ]; } - public function dataWhileLoopVariables(): array + public static function dataWhileLoopVariables(): array { return [ [ @@ -7043,7 +7043,7 @@ public function dataWhileLoopVariables(): array ]; } - public function dataForLoopVariables(): array + public static function dataForLoopVariables(): array { return [ [ @@ -7133,7 +7133,7 @@ public function testForLoopVariables( ); } - public function dataDoWhileLoopVariables(): array + public static function dataDoWhileLoopVariables(): array { return [ [ @@ -7242,7 +7242,7 @@ public function testDoWhileLoopVariables( ); } - public function dataMultipleClassesInOneFile(): array + public static function dataMultipleClassesInOneFile(): array { return [ [ @@ -7275,7 +7275,7 @@ public function testMultipleClassesInOneFile( ); } - public function dataCallingMultipleClassesInOneFile(): array + public static function dataCallingMultipleClassesInOneFile(): array { return [ [ @@ -7304,7 +7304,7 @@ public function testCallingMultipleClassesInOneFile( ); } - public function dataExplode(): array + public static function dataExplode(): array { return [ [ @@ -7345,7 +7345,7 @@ public function testExplode( ); } - public function dataArrayPointerFunctions(): array + public static function dataArrayPointerFunctions(): array { return [ [ @@ -7438,7 +7438,7 @@ public function testArrayPointerFunctions( ); } - public function dataReplaceFunctions(): array + public static function dataReplaceFunctions(): array { return [ [ @@ -7515,7 +7515,7 @@ public function testReplaceFunctions( ); } - public function dataFilterVar(): Generator + public static function dataFilterVar(): Generator { $typesAndFilters = [ 'string' => [ @@ -7622,7 +7622,7 @@ public function dataFilterVar(): Generator ]; } - public function dataFilterVarUnchanged(): array + public static function dataFilterVarUnchanged(): array { return [ [ @@ -7676,7 +7676,7 @@ public function testFilterVar( ); } - public function dataClosureWithUsePassedByReference(): array + public static function dataClosureWithUsePassedByReference(): array { return [ [ @@ -7789,7 +7789,7 @@ public function testClosureWithUsePassedByReference( ); } - public function dataClosureWithUsePassedByReferenceInMethodCall(): array + public static function dataClosureWithUsePassedByReferenceInMethodCall(): array { return [ [ @@ -7814,7 +7814,7 @@ public function testClosureWithUsePassedByReferenceInMethodCall( ); } - public function dataClosureWithUsePassedByReferenceReturn(): array + public static function dataClosureWithUsePassedByReferenceReturn(): array { return [ [ @@ -7840,7 +7840,7 @@ public function dataClosureWithUsePassedByReferenceReturn(): array ]; } - public function dataStaticClosure(): array + public static function dataStaticClosure(): array { return [ [ @@ -7882,7 +7882,7 @@ public function testClosureWithUsePassedByReferenceReturn( ); } - public function dataClosureWithInferredTypehint(): array + public static function dataClosureWithInferredTypehint(): array { return [ [ @@ -7914,7 +7914,7 @@ public function testClosureWithInferredTypehint( ); } - public function dataTraitsPhpDocs(): array + public static function dataTraitsPhpDocs(): array { return [ [ @@ -8019,7 +8019,7 @@ public function testTraitsPhpDocs( ); } - public function dataPassedByReference(): array + public static function dataPassedByReference(): array { return [ [ @@ -8052,7 +8052,7 @@ public function testPassedByReference( ); } - public function dataCallables(): array + public static function dataCallables(): array { return [ [ @@ -8097,7 +8097,7 @@ public function testCallables( ); } - public function dataArrayKeysInBranches(): array + public static function dataArrayKeysInBranches(): array { return [ [ @@ -8154,7 +8154,7 @@ public function testArrayKeysInBranches( ); } - public function dataSpecifiedFunctionCall(): array + public static function dataSpecifiedFunctionCall(): array { return [ [ @@ -8202,7 +8202,7 @@ public function testSpecifiedFunctionCall( ); } - public function dataElementsOnMixed(): array + public static function dataElementsOnMixed(): array { return [ [ @@ -8243,7 +8243,7 @@ public function testElementsOnMixed( ); } - public function dataCaseInsensitivePhpDocTypes(): array + public static function dataCaseInsensitivePhpDocTypes(): array { return [ [ @@ -8272,7 +8272,7 @@ public function testCaseInsensitivePhpDocTypes( ); } - public function dataConstantTypeAfterDuplicateCondition(): array + public static function dataConstantTypeAfterDuplicateCondition(): array { return [ [ @@ -8355,7 +8355,7 @@ public function testConstantTypeAfterDuplicateCondition( ); } - public function dataAnonymousClass(): array + public static function dataAnonymousClass(): array { return [ [ @@ -8408,7 +8408,7 @@ public function testAnonymousClassName( ); } - public function dataAnonymousClassInTrait(): array + public static function dataAnonymousClassInTrait(): array { return [ [ @@ -8433,7 +8433,7 @@ public function testAnonymousClassNameInTrait( ); } - public function dataAnonymousClassNameSameLine(): array + public static function dataAnonymousClassNameSameLine(): array { return [ [ @@ -8471,7 +8471,7 @@ public function testAnonymousClassNameSameLine( ); } - public function dataDynamicConstants(): array + public static function dataDynamicConstants(): array { return [ [ @@ -8517,7 +8517,7 @@ public function testDynamicConstants( ); } - public function dataDynamicConstantsWithNativeTypes(): array + public static function dataDynamicConstantsWithNativeTypes(): array { return [ [ @@ -8563,7 +8563,7 @@ public function testDynamicConstantsWithNativeTypes( ); } - public function dataIsset(): array + public static function dataIsset(): array { return [ [ @@ -8644,7 +8644,7 @@ public function testIsset( ); } - public function dataPropertyArrayAssignment(): array + public static function dataPropertyArrayAssignment(): array { return [ [ @@ -8692,7 +8692,7 @@ public function testPropertyArrayAssignment( ); } - public function dataGetParentClass(): array + public static function dataGetParentClass(): array { return [ [ @@ -8783,7 +8783,7 @@ public function testGetParentClass( ); } - public function dataIsCountable(): array + public static function dataIsCountable(): array { return [ [ @@ -8816,7 +8816,7 @@ public function testIsCountable( ); } - public function dataPhp73Functions(): array + public static function dataPhp73Functions(): array { return [ [ @@ -8953,7 +8953,7 @@ public function testPhp73Functions( ); } - public function dataPhp74Functions(): array + public static function dataPhp74Functions(): array { return [ [ @@ -9082,7 +9082,7 @@ public function testPhp74Functions( ); } - public function dataUnionMethods(): array + public static function dataUnionMethods(): array { return [ [ @@ -9111,7 +9111,7 @@ public function testUnionMethods( ); } - public function dataUnionProperties(): array + public static function dataUnionProperties(): array { return [ [ @@ -9140,7 +9140,7 @@ public function testUnionProperties( ); } - public function dataAssignmentInCondition(): array + public static function dataAssignmentInCondition(): array { return [ [ @@ -9165,7 +9165,7 @@ public function testAssignmentInCondition( ); } - public function dataGeneralizeScope(): array + public static function dataGeneralizeScope(): array { return [ [ @@ -9190,7 +9190,7 @@ public function testGeneralizeScope( ); } - public function dataGeneralizeScopeRecursiveType(): array + public static function dataGeneralizeScopeRecursiveType(): array { return [ [ @@ -9215,7 +9215,7 @@ public function testGeneralizeScopeRecursiveType( ); } - public function dataArrayShapesInPhpDoc(): array + public static function dataArrayShapesInPhpDoc(): array { return [ [ @@ -9248,7 +9248,7 @@ public function testArrayShapesInPhpDoc( ); } - public function dataInferPrivatePropertyTypeFromConstructor(): array + public static function dataInferPrivatePropertyTypeFromConstructor(): array { return [ [ @@ -9301,7 +9301,7 @@ public function testInferPrivatePropertyTypeFromConstructor( ); } - public function dataPropertyNativeTypes(): array + public static function dataPropertyNativeTypes(): array { return [ [ @@ -9334,7 +9334,7 @@ public function testPropertyNativeTypes( ); } - public function dataArrowFunctions(): array + public static function dataArrowFunctions(): array { return [ [ @@ -9367,7 +9367,7 @@ public function testArrowFunctions( ); } - public function dataArrowFunctionsInside(): array + public static function dataArrowFunctionsInside(): array { return [ [ @@ -9400,7 +9400,7 @@ public function testArrowFunctionsInside( ); } - public function dataCoalesceAssign(): array + public static function dataCoalesceAssign(): array { return [ [ @@ -9457,7 +9457,7 @@ public function testCoalesceAssign( ); } - public function dataArraySpread(): array + public static function dataArraySpread(): array { return [ [ @@ -9506,7 +9506,7 @@ public function testArraySpread( ); } - public function dataPhp74FunctionsIn74(): array + public static function dataPhp74FunctionsIn74(): array { return [ [ @@ -9531,7 +9531,7 @@ public function testPhp74FunctionsIn74( ); } - public function dataTryCatchScope(): array + public static function dataTryCatchScope(): array { return [ [ @@ -9626,7 +9626,7 @@ public static function getAdditionalConfigFiles(): array ]; } - public function dataDeclareStrictTypes(): array + public static function dataDeclareStrictTypes(): array { return [ [ diff --git a/tests/PHPStan/Analyser/LooseConstComparisonPhp7Test.php b/tests/PHPStan/Analyser/LooseConstComparisonPhp7Test.php index 83bb27b70b..39bab1d4d7 100644 --- a/tests/PHPStan/Analyser/LooseConstComparisonPhp7Test.php +++ b/tests/PHPStan/Analyser/LooseConstComparisonPhp7Test.php @@ -10,11 +10,11 @@ class LooseConstComparisonPhp7Test extends TypeInferenceTestCase /** * @return iterable> */ - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { // compares constants according to the php-version phpstan configuration, // _NOT_ the current php runtime version - yield from $this->gatherAssertTypes(__DIR__ . '/data/loose-const-comparison-php7.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/loose-const-comparison-php7.php'); } /** diff --git a/tests/PHPStan/Analyser/LooseConstComparisonPhp8Test.php b/tests/PHPStan/Analyser/LooseConstComparisonPhp8Test.php index e765ca01d5..29cd3a9c23 100644 --- a/tests/PHPStan/Analyser/LooseConstComparisonPhp8Test.php +++ b/tests/PHPStan/Analyser/LooseConstComparisonPhp8Test.php @@ -10,11 +10,11 @@ class LooseConstComparisonPhp8Test extends TypeInferenceTestCase /** * @return iterable> */ - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { // compares constants according to the php-version phpstan configuration, // _NOT_ the current php runtime version - yield from $this->gatherAssertTypes(__DIR__ . '/data/loose-const-comparison-php8.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/loose-const-comparison-php8.php'); } /** diff --git a/tests/PHPStan/Analyser/NodeScopeResolverTest.php b/tests/PHPStan/Analyser/NodeScopeResolverTest.php index a2e9ef0619..17ca49e45d 100644 --- a/tests/PHPStan/Analyser/NodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/NodeScopeResolverTest.php @@ -127,7 +127,7 @@ private static function findTestFiles(): iterable } //define('ALREADY_DEFINED_CONSTANT', true); - //yield from $this->gatherAssertTypes(__DIR__ . '/data/already-defined-constant.php'); + //yield from self::gatherAssertTypes(__DIR__ . '/data/already-defined-constant.php'); yield __DIR__ . '/../Rules/Methods/data/conditional-complex-templates.php'; @@ -239,7 +239,7 @@ public static function dataFile(): iterable */ public function testFile(string $file): void { - $asserts = $this->gatherAssertTypes($file); + $asserts = self::gatherAssertTypes($file); $this->assertNotCount(0, $asserts, sprintf('File %s has no asserts.', $file)); $failures = []; diff --git a/tests/PHPStan/Analyser/ParamClosureThisStubsTest.php b/tests/PHPStan/Analyser/ParamClosureThisStubsTest.php index 795707aabb..2f7e6c47de 100644 --- a/tests/PHPStan/Analyser/ParamClosureThisStubsTest.php +++ b/tests/PHPStan/Analyser/ParamClosureThisStubsTest.php @@ -7,9 +7,9 @@ class ParamClosureThisStubsTest extends TypeInferenceTestCase { - public function dataAsserts(): iterable + public static function dataAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/param-closure-this-stubs.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/param-closure-this-stubs.php'); } /** diff --git a/tests/PHPStan/Analyser/ParamOutTypeTest.php b/tests/PHPStan/Analyser/ParamOutTypeTest.php index b29b6fbd0c..eaceedfeca 100644 --- a/tests/PHPStan/Analyser/ParamOutTypeTest.php +++ b/tests/PHPStan/Analyser/ParamOutTypeTest.php @@ -7,9 +7,9 @@ class ParamOutTypeTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/param-out.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/param-out.php'); } /** diff --git a/tests/PHPStan/Analyser/ParameterClosureTypeExtensionArrowFunctionTest.php b/tests/PHPStan/Analyser/ParameterClosureTypeExtensionArrowFunctionTest.php index c3476c32fa..5476369a99 100644 --- a/tests/PHPStan/Analyser/ParameterClosureTypeExtensionArrowFunctionTest.php +++ b/tests/PHPStan/Analyser/ParameterClosureTypeExtensionArrowFunctionTest.php @@ -7,9 +7,9 @@ class ParameterClosureTypeExtensionArrowFunctionTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/parameter-closure-type-extension-arrow-function.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/parameter-closure-type-extension-arrow-function.php'); } /** diff --git a/tests/PHPStan/Analyser/ParameterClosureTypeExtensionTest.php b/tests/PHPStan/Analyser/ParameterClosureTypeExtensionTest.php index 4b990f1f72..c44cf2aed7 100644 --- a/tests/PHPStan/Analyser/ParameterClosureTypeExtensionTest.php +++ b/tests/PHPStan/Analyser/ParameterClosureTypeExtensionTest.php @@ -7,9 +7,9 @@ class ParameterClosureTypeExtensionTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/parameter-closure-type-extension.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/parameter-closure-type-extension.php'); } /** diff --git a/tests/PHPStan/Analyser/ParameterOutTypeExtensionTest.php b/tests/PHPStan/Analyser/ParameterOutTypeExtensionTest.php index e32c7c3ca3..e7c95c360b 100644 --- a/tests/PHPStan/Analyser/ParameterOutTypeExtensionTest.php +++ b/tests/PHPStan/Analyser/ParameterOutTypeExtensionTest.php @@ -7,9 +7,9 @@ class ParameterOutTypeExtensionTest extends TypeInferenceTestCase { - public function dataAsserts(): iterable + public static function dataAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/param-out/parameter-out-types.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/param-out/parameter-out-types.php'); } /** diff --git a/tests/PHPStan/Analyser/PathConstantsTest.php b/tests/PHPStan/Analyser/PathConstantsTest.php index 39832befa4..8df12570e9 100644 --- a/tests/PHPStan/Analyser/PathConstantsTest.php +++ b/tests/PHPStan/Analyser/PathConstantsTest.php @@ -8,12 +8,12 @@ class PathConstantsTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { if (DIRECTORY_SEPARATOR === '\\') { - yield from $this->gatherAssertTypes(__DIR__ . '/data/pathConstants-win.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/pathConstants-win.php'); } else { - yield from $this->gatherAssertTypes(__DIR__ . '/data/pathConstants.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/pathConstants.php'); } } diff --git a/tests/PHPStan/Analyser/ScopePhpVersionTest.php b/tests/PHPStan/Analyser/ScopePhpVersionTest.php index fac3b8a066..4a72193ac2 100644 --- a/tests/PHPStan/Analyser/ScopePhpVersionTest.php +++ b/tests/PHPStan/Analyser/ScopePhpVersionTest.php @@ -10,7 +10,7 @@ class ScopePhpVersionTest extends TypeInferenceTestCase { - public function dataTestPhpVersion(): array + public static function dataTestPhpVersion(): array { return [ [ diff --git a/tests/PHPStan/Analyser/ScopeTest.php b/tests/PHPStan/Analyser/ScopeTest.php index 4612ef1596..8452971c0c 100644 --- a/tests/PHPStan/Analyser/ScopeTest.php +++ b/tests/PHPStan/Analyser/ScopeTest.php @@ -23,7 +23,7 @@ class ScopeTest extends PHPStanTestCase { - public function dataGeneralize(): array + public static function dataGeneralize(): array { return [ [ diff --git a/tests/PHPStan/Analyser/StatementResultTest.php b/tests/PHPStan/Analyser/StatementResultTest.php index c8509d48c8..74bec6d6dd 100644 --- a/tests/PHPStan/Analyser/StatementResultTest.php +++ b/tests/PHPStan/Analyser/StatementResultTest.php @@ -15,7 +15,7 @@ class StatementResultTest extends PHPStanTestCase { - public function dataIsAlwaysTerminating(): array + public static function dataIsAlwaysTerminating(): array { return [ [ diff --git a/tests/PHPStan/Analyser/ThrowsTagFromNativeFunctionStubTest.php b/tests/PHPStan/Analyser/ThrowsTagFromNativeFunctionStubTest.php index a6f515560b..1bfcc94ca5 100644 --- a/tests/PHPStan/Analyser/ThrowsTagFromNativeFunctionStubTest.php +++ b/tests/PHPStan/Analyser/ThrowsTagFromNativeFunctionStubTest.php @@ -7,9 +7,9 @@ class ThrowsTagFromNativeFunctionStubTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/throws-tag-from-native-function-stub.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/throws-tag-from-native-function-stub.php'); } /** diff --git a/tests/PHPStan/Analyser/TraitStubFilesTest.php b/tests/PHPStan/Analyser/TraitStubFilesTest.php index 9107f5f45c..9f052f9fd6 100644 --- a/tests/PHPStan/Analyser/TraitStubFilesTest.php +++ b/tests/PHPStan/Analyser/TraitStubFilesTest.php @@ -7,9 +7,9 @@ class TraitStubFilesTest extends TypeInferenceTestCase { - public function dataFileAsserts(): iterable + public static function dataFileAsserts(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/trait-stubs.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/trait-stubs.php'); } /** diff --git a/tests/PHPStan/Analyser/TypeSpecifierContextTest.php b/tests/PHPStan/Analyser/TypeSpecifierContextTest.php index c6e083ed5d..1be1d94460 100644 --- a/tests/PHPStan/Analyser/TypeSpecifierContextTest.php +++ b/tests/PHPStan/Analyser/TypeSpecifierContextTest.php @@ -8,7 +8,7 @@ class TypeSpecifierContextTest extends PHPStanTestCase { - public function dataContext(): array + public static function dataContext(): array { return [ [ @@ -47,7 +47,7 @@ public function testContext(TypeSpecifierContext $context, array $results): void $this->assertSame($results[4], $context->null()); } - public function dataNegate(): array + public static function dataNegate(): array { return [ [ diff --git a/tests/PHPStan/Analyser/TypeSpecifierTest.php b/tests/PHPStan/Analyser/TypeSpecifierTest.php index 0957b36f22..0cfffa6bb6 100644 --- a/tests/PHPStan/Analyser/TypeSpecifierTest.php +++ b/tests/PHPStan/Analyser/TypeSpecifierTest.php @@ -58,7 +58,7 @@ class TypeSpecifierTest extends PHPStanTestCase protected function setUp(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $this->printer = new Printer(); $this->typeSpecifier = self::getContainer()->getService('typeSpecifier'); $this->scope = $this->createScopeFactory($reflectionProvider, $this->typeSpecifier)->create(ScopeContext::create('')); @@ -95,7 +95,7 @@ public function testCondition(Expr $expr, array $expectedPositiveResult, array $ $this->assertSame($expectedNegatedResult, $actualResult, sprintf('if not (%s)', $this->printer->prettyPrintExpr($expr))); } - public function dataCondition(): iterable + public static function dataCondition(): iterable { if (PHP_VERSION_ID >= 80100) { yield [ @@ -131,86 +131,86 @@ public function dataCondition(): iterable } yield from [ [ - $this->createFunctionCall('is_int'), + self::createFunctionCall('is_int'), ['$foo' => 'int'], ['$foo' => '~int'], ], [ - $this->createFunctionCall('is_numeric'), + self::createFunctionCall('is_numeric'), ['$foo' => 'float|int|numeric-string'], ['$foo' => '~float|int|numeric-string'], ], [ - $this->createFunctionCall('is_scalar'), + self::createFunctionCall('is_scalar'), ['$foo' => 'bool|float|int|string'], ['$foo' => '~bool|float|int|string'], ], [ new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_int'), - $this->createFunctionCall('random'), + self::createFunctionCall('is_int'), + self::createFunctionCall('random'), ), ['$foo' => 'int'], [], ], [ new Expr\BinaryOp\BooleanOr( - $this->createFunctionCall('is_int'), - $this->createFunctionCall('random'), + self::createFunctionCall('is_int'), + self::createFunctionCall('random'), ), [], ['$foo' => '~int'], ], [ new Expr\BinaryOp\LogicalAnd( - $this->createFunctionCall('is_int'), - $this->createFunctionCall('random'), + self::createFunctionCall('is_int'), + self::createFunctionCall('random'), ), ['$foo' => 'int'], [], ], [ new Expr\BinaryOp\LogicalOr( - $this->createFunctionCall('is_int'), - $this->createFunctionCall('random'), + self::createFunctionCall('is_int'), + self::createFunctionCall('random'), ), [], ['$foo' => '~int'], ], [ - new Expr\BooleanNot($this->createFunctionCall('is_int')), + new Expr\BooleanNot(self::createFunctionCall('is_int')), ['$foo' => '~int'], ['$foo' => 'int'], ], [ new Expr\BinaryOp\BooleanAnd( - new Expr\BooleanNot($this->createFunctionCall('is_int')), - $this->createFunctionCall('random'), + new Expr\BooleanNot(self::createFunctionCall('is_int')), + self::createFunctionCall('random'), ), ['$foo' => '~int'], [], ], [ new Expr\BinaryOp\BooleanOr( - new Expr\BooleanNot($this->createFunctionCall('is_int')), - $this->createFunctionCall('random'), + new Expr\BooleanNot(self::createFunctionCall('is_int')), + self::createFunctionCall('random'), ), [], ['$foo' => 'int'], ], [ - new Expr\BooleanNot(new Expr\BooleanNot($this->createFunctionCall('is_int'))), + new Expr\BooleanNot(new Expr\BooleanNot(self::createFunctionCall('is_int'))), ['$foo' => 'int'], ['$foo' => '~int'], ], [ - $this->createInstanceOf('Foo'), + self::createInstanceOf('Foo'), ['$foo' => 'Foo'], ['$foo' => '~Foo'], ], [ - new Expr\BooleanNot($this->createInstanceOf('Foo')), + new Expr\BooleanNot(self::createInstanceOf('Foo')), ['$foo' => '~Foo'], ['$foo' => 'Foo'], ], @@ -280,7 +280,7 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanAnd( new Variable('foo'), - $this->createFunctionCall('random'), + self::createFunctionCall('random'), ), ['$foo' => self::SURE_NOT_FALSEY], [], @@ -288,7 +288,7 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanOr( new Variable('foo'), - $this->createFunctionCall('random'), + self::createFunctionCall('random'), ), [], ['$foo' => self::SURE_NOT_TRUTHY], @@ -307,7 +307,7 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanAnd( new PropertyFetch(new Variable('this'), 'foo'), - $this->createFunctionCall('random'), + self::createFunctionCall('random'), ), ['$this->foo' => self::SURE_NOT_FALSEY], [], @@ -315,7 +315,7 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanOr( new PropertyFetch(new Variable('this'), 'foo'), - $this->createFunctionCall('random'), + self::createFunctionCall('random'), ), [], ['$this->foo' => self::SURE_NOT_TRUTHY], @@ -328,18 +328,18 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanOr( - $this->createFunctionCall('is_int'), - $this->createFunctionCall('is_string'), + self::createFunctionCall('is_int'), + self::createFunctionCall('is_string'), ), ['$foo' => 'int|string'], ['$foo' => '~int|string'], ], [ new Expr\BinaryOp\BooleanOr( - $this->createFunctionCall('is_int'), + self::createFunctionCall('is_int'), new Expr\BinaryOp\BooleanOr( - $this->createFunctionCall('is_string'), - $this->createFunctionCall('is_bool'), + self::createFunctionCall('is_string'), + self::createFunctionCall('is_bool'), ), ), ['$foo' => 'bool|int|string'], @@ -347,8 +347,8 @@ public function dataCondition(): iterable ], [ new Expr\BinaryOp\BooleanOr( - $this->createFunctionCall('is_int', 'foo'), - $this->createFunctionCall('is_string', 'bar'), + self::createFunctionCall('is_int', 'foo'), + self::createFunctionCall('is_string', 'bar'), ), [], ['$foo' => '~int', '$bar' => '~string'], @@ -356,10 +356,10 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanAnd( new Expr\BinaryOp\BooleanOr( - $this->createFunctionCall('is_int', 'foo'), - $this->createFunctionCall('is_string', 'foo'), + self::createFunctionCall('is_int', 'foo'), + self::createFunctionCall('is_string', 'foo'), ), - $this->createFunctionCall('random'), + self::createFunctionCall('random'), ), ['$foo' => 'int|string'], [], @@ -367,10 +367,10 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanOr( new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_int', 'foo'), - $this->createFunctionCall('is_string', 'foo'), + self::createFunctionCall('is_int', 'foo'), + self::createFunctionCall('is_string', 'foo'), ), - $this->createFunctionCall('random'), + self::createFunctionCall('random'), ), [], ['$foo' => 'mixed'], @@ -378,10 +378,10 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanOr( new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_int', 'foo'), - $this->createFunctionCall('is_string', 'bar'), + self::createFunctionCall('is_int', 'foo'), + self::createFunctionCall('is_string', 'bar'), ), - $this->createFunctionCall('random'), + self::createFunctionCall('random'), ), [], [], @@ -389,10 +389,10 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanOr( new Expr\BinaryOp\BooleanAnd( - new Expr\BooleanNot($this->createFunctionCall('is_int', 'foo')), - new Expr\BooleanNot($this->createFunctionCall('is_string', 'foo')), + new Expr\BooleanNot(self::createFunctionCall('is_int', 'foo')), + new Expr\BooleanNot(self::createFunctionCall('is_string', 'foo')), ), - $this->createFunctionCall('random'), + self::createFunctionCall('random'), ), [], ['$foo' => 'int|string'], @@ -400,10 +400,10 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanAnd( new Expr\BinaryOp\BooleanOr( - new Expr\BooleanNot($this->createFunctionCall('is_int', 'foo')), - new Expr\BooleanNot($this->createFunctionCall('is_string', 'foo')), + new Expr\BooleanNot(self::createFunctionCall('is_int', 'foo')), + new Expr\BooleanNot(self::createFunctionCall('is_string', 'foo')), ), - $this->createFunctionCall('random'), + self::createFunctionCall('random'), ), ['$foo' => 'mixed'], [], @@ -427,7 +427,7 @@ public function dataCondition(): iterable ], [ new Identical( - $this->createFunctionCall('is_int'), + self::createFunctionCall('is_int'), new Expr\ConstFetch(new Name('true')), ), ['is_int($foo)' => 'true', '$foo' => 'int'], @@ -435,7 +435,7 @@ public function dataCondition(): iterable ], [ new Identical( - $this->createFunctionCall('is_string'), + self::createFunctionCall('is_string'), new Expr\ConstFetch(new Name('true')), ), ['is_string($foo)' => 'true', '$foo' => 'string'], @@ -443,7 +443,7 @@ public function dataCondition(): iterable ], [ new Identical( - $this->createFunctionCall('is_int'), + self::createFunctionCall('is_int'), new Expr\ConstFetch(new Name('false')), ), ['is_int($foo)' => 'false', '$foo' => '~int'], @@ -451,7 +451,7 @@ public function dataCondition(): iterable ], [ new Equal( - $this->createFunctionCall('is_int'), + self::createFunctionCall('is_int'), new Expr\ConstFetch(new Name('true')), ), ['$foo' => 'int'], @@ -459,7 +459,7 @@ public function dataCondition(): iterable ], [ new Equal( - $this->createFunctionCall('is_int'), + self::createFunctionCall('is_int'), new Expr\ConstFetch(new Name('false')), ), ['$foo' => '~int'], @@ -1183,7 +1183,7 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanOr( new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_string', 'a'), + self::createFunctionCall('is_string', 'a'), new NotIdentical(new String_(''), new Variable('a')), ), new Identical(new Expr\ConstFetch(new Name('null')), new Variable('a')), @@ -1194,9 +1194,9 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanOr( new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_string', 'a'), + self::createFunctionCall('is_string', 'a'), new Expr\BinaryOp\Greater( - $this->createFunctionCall('strlen', 'a'), + self::createFunctionCall('strlen', 'a'), new LNumber(0), ), ), @@ -1208,9 +1208,9 @@ public function dataCondition(): iterable [ new Expr\BinaryOp\BooleanOr( new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_array', 'a'), + self::createFunctionCall('is_array', 'a'), new Expr\BinaryOp\Greater( - $this->createFunctionCall('count', 'a'), + self::createFunctionCall('count', 'a'), new LNumber(0), ), ), @@ -1221,7 +1221,7 @@ public function dataCondition(): iterable ], [ new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_array', 'foo'), + self::createFunctionCall('is_array', 'foo'), new Identical( new FuncCall( new Name('array_filter'), @@ -1238,7 +1238,7 @@ public function dataCondition(): iterable ], [ new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_array', 'foo'), + self::createFunctionCall('is_array', 'foo'), new Expr\BinaryOp\GreaterOrEqual( new FuncCall( new Name('count'), @@ -1255,7 +1255,7 @@ public function dataCondition(): iterable ], [ new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_array', 'foo'), + self::createFunctionCall('is_array', 'foo'), new Identical( new FuncCall( new Name('count'), @@ -1272,7 +1272,7 @@ public function dataCondition(): iterable ], [ new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_string', 'foo'), + self::createFunctionCall('is_string', 'foo'), new NotIdentical( new FuncCall( new Name('strlen'), @@ -1291,7 +1291,7 @@ public function dataCondition(): iterable ], [ new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_numeric', 'int'), + self::createFunctionCall('is_numeric', 'int'), new Expr\BinaryOp\Equal( new Variable('int'), new Expr\Cast\Int_(new Variable('int')), @@ -1305,7 +1305,7 @@ public function dataCondition(): iterable ], [ new Expr\BinaryOp\BooleanAnd( - $this->createFunctionCall('is_numeric', 'float'), + self::createFunctionCall('is_numeric', 'float'), new Expr\BinaryOp\Equal( new Variable('float'), new Expr\Cast\Int_(new Variable('float')), @@ -1346,7 +1346,7 @@ private function toReadableResult(SpecifiedTypes $specifiedTypes): array /** * @param non-empty-string $className */ - private function createInstanceOf(string $className, string $variableName = 'foo'): Expr\Instanceof_ + private static function createInstanceOf(string $className, string $variableName = 'foo'): Expr\Instanceof_ { return new Expr\Instanceof_(new Variable($variableName), new Name($className)); } @@ -1354,7 +1354,7 @@ private function createInstanceOf(string $className, string $variableName = 'foo /** * @param non-empty-string $functionName */ - private function createFunctionCall(string $functionName, string $variableName = 'foo'): FuncCall + private static function createFunctionCall(string $functionName, string $variableName = 'foo'): FuncCall { return new FuncCall(new Name($functionName), [new Arg(new Variable($variableName))]); } diff --git a/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceFalseTest.php b/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceFalseTest.php index 3378922993..c1106b1523 100644 --- a/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceFalseTest.php +++ b/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceFalseTest.php @@ -7,11 +7,11 @@ class TypeSpecifyingExtensionTypeInferenceFalseTest extends TypeInferenceTestCase { - public function dataTypeSpecifyingExtensionsFalse(): iterable + public static function dataTypeSpecifyingExtensionsFalse(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-false.php'); - yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-false.php'); - yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-false.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-false.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-false.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-false.php'); } /** diff --git a/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceNullTest.php b/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceNullTest.php index bc8276fb59..b3c8615e4c 100644 --- a/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceNullTest.php +++ b/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceNullTest.php @@ -7,11 +7,11 @@ class TypeSpecifyingExtensionTypeInferenceNullTest extends TypeInferenceTestCase { - public function dataTypeSpecifyingExtensionsNull(): iterable + public static function dataTypeSpecifyingExtensionsNull(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-null.php'); - yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-null.php'); - yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-null.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-null.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-null.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-null.php'); } /** diff --git a/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceTrueTest.php b/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceTrueTest.php index 7478a93f2a..4c72d55049 100644 --- a/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceTrueTest.php +++ b/tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceTrueTest.php @@ -7,11 +7,11 @@ class TypeSpecifyingExtensionTypeInferenceTrueTest extends TypeInferenceTestCase { - public function dataTypeSpecifyingExtensionsTrue(): iterable + public static function dataTypeSpecifyingExtensionsTrue(): iterable { - yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-true.php'); - yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-true.php'); - yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-true.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-true.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-true.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-true.php'); } /** diff --git a/tests/PHPStan/Build/AttributeNamedArgumentsRuleTest.php b/tests/PHPStan/Build/AttributeNamedArgumentsRuleTest.php index 94953f813d..2e3c99ad9e 100644 --- a/tests/PHPStan/Build/AttributeNamedArgumentsRuleTest.php +++ b/tests/PHPStan/Build/AttributeNamedArgumentsRuleTest.php @@ -13,7 +13,7 @@ class AttributeNamedArgumentsRuleTest extends RuleTestCase protected function getRule(): Rule { - return new AttributeNamedArgumentsRule($this->createReflectionProvider()); + return new AttributeNamedArgumentsRule(self::createReflectionProvider()); } public function testRule(): void diff --git a/tests/PHPStan/Build/NamedArgumentsRuleTest.php b/tests/PHPStan/Build/NamedArgumentsRuleTest.php index 45647bf7d8..67573b49e3 100644 --- a/tests/PHPStan/Build/NamedArgumentsRuleTest.php +++ b/tests/PHPStan/Build/NamedArgumentsRuleTest.php @@ -15,7 +15,7 @@ class NamedArgumentsRuleTest extends RuleTestCase protected function getRule(): Rule { - return new NamedArgumentsRule($this->createReflectionProvider(), new PhpVersion(PHP_VERSION_ID)); + return new NamedArgumentsRule(self::createReflectionProvider(), new PhpVersion(PHP_VERSION_ID)); } public function testRule(): void diff --git a/tests/PHPStan/Command/CommandHelperTest.php b/tests/PHPStan/Command/CommandHelperTest.php index fdfe893d28..c1d1c5b1fc 100644 --- a/tests/PHPStan/Command/CommandHelperTest.php +++ b/tests/PHPStan/Command/CommandHelperTest.php @@ -19,7 +19,7 @@ class CommandHelperTest extends TestCase { - public function dataBegin(): array + public static function dataBegin(): array { return [ [ @@ -162,7 +162,7 @@ public function testBegin( } } - public function dataParameters(): array + public static function dataParameters(): array { return [ [ diff --git a/tests/PHPStan/Command/ErrorFormatter/BaselineNeonErrorFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/BaselineNeonErrorFormatterTest.php index 546eda16f8..8b3a49e012 100644 --- a/tests/PHPStan/Command/ErrorFormatter/BaselineNeonErrorFormatterTest.php +++ b/tests/PHPStan/Command/ErrorFormatter/BaselineNeonErrorFormatterTest.php @@ -28,7 +28,7 @@ class BaselineNeonErrorFormatterTest extends ErrorFormatterTestCase { - public function dataFormatterOutputProvider(): iterable + public static function dataFormatterOutputProvider(): iterable { yield [ 'No errors', @@ -219,7 +219,7 @@ public function testEscapeDiNeon(): void /** * @return Generator}, void, void> */ - public function outputOrderingProvider(): Generator + public static function outputOrderingProvider(): Generator { $errors = [ new Error('Error #2', 'TestfileA', 1), @@ -314,7 +314,7 @@ public function testOutputOrdering(array $errors): void /** * @return Generator}> */ - public function endOfFileNewlinesProvider(): Generator + public static function endOfFileNewlinesProvider(): Generator { $existingBaselineContentWithoutEndNewlines = 'parameters: ignoreErrors: @@ -448,7 +448,7 @@ public function testEndOfFileNewlines( Assert::assertNotSame("\n", substr($content, -($expectedNewlinesCount + 1), 1)); } - public function dataFormatErrorsWithIdentifiers(): iterable + public static function dataFormatErrorsWithIdentifiers(): iterable { yield [ [ diff --git a/tests/PHPStan/Command/ErrorFormatter/BaselinePhpErrorFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/BaselinePhpErrorFormatterTest.php index e9590e9402..78244e2a67 100644 --- a/tests/PHPStan/Command/ErrorFormatter/BaselinePhpErrorFormatterTest.php +++ b/tests/PHPStan/Command/ErrorFormatter/BaselinePhpErrorFormatterTest.php @@ -10,7 +10,7 @@ class BaselinePhpErrorFormatterTest extends ErrorFormatterTestCase { - public function dataFormatErrors(): iterable + public static function dataFormatErrors(): iterable { yield [ [ diff --git a/tests/PHPStan/Command/ErrorFormatter/CheckstyleErrorFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/CheckstyleErrorFormatterTest.php index 4fb960aa66..da53c07c52 100644 --- a/tests/PHPStan/Command/ErrorFormatter/CheckstyleErrorFormatterTest.php +++ b/tests/PHPStan/Command/ErrorFormatter/CheckstyleErrorFormatterTest.php @@ -11,7 +11,7 @@ class CheckstyleErrorFormatterTest extends ErrorFormatterTestCase { - public function dataFormatterOutputProvider(): iterable + public static function dataFormatterOutputProvider(): iterable { yield [ 'No errors', diff --git a/tests/PHPStan/Command/ErrorFormatter/GithubErrorFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/GithubErrorFormatterTest.php index 3a93977ce5..0d185dd949 100644 --- a/tests/PHPStan/Command/ErrorFormatter/GithubErrorFormatterTest.php +++ b/tests/PHPStan/Command/ErrorFormatter/GithubErrorFormatterTest.php @@ -10,7 +10,7 @@ class GithubErrorFormatterTest extends ErrorFormatterTestCase { - public function dataFormatterOutputProvider(): iterable + public static function dataFormatterOutputProvider(): iterable { yield [ 'No errors', diff --git a/tests/PHPStan/Command/ErrorFormatter/GitlabFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/GitlabFormatterTest.php index 78df3d79dd..27c95d82c6 100644 --- a/tests/PHPStan/Command/ErrorFormatter/GitlabFormatterTest.php +++ b/tests/PHPStan/Command/ErrorFormatter/GitlabFormatterTest.php @@ -9,7 +9,7 @@ class GitlabFormatterTest extends ErrorFormatterTestCase { - public function dataFormatterOutputProvider(): iterable + public static function dataFormatterOutputProvider(): iterable { yield [ 'No errors', diff --git a/tests/PHPStan/Command/ErrorFormatter/JsonErrorFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/JsonErrorFormatterTest.php index a2baee1e86..61be3c1b4d 100644 --- a/tests/PHPStan/Command/ErrorFormatter/JsonErrorFormatterTest.php +++ b/tests/PHPStan/Command/ErrorFormatter/JsonErrorFormatterTest.php @@ -11,7 +11,7 @@ class JsonErrorFormatterTest extends ErrorFormatterTestCase { - public function dataFormatterOutputProvider(): iterable + public static function dataFormatterOutputProvider(): iterable { yield [ 'No errors', @@ -238,7 +238,7 @@ public function testFormatErrors( $this->assertJsonStringEqualsJsonString($expected, $this->getOutputContent(), sprintf('%s: JSON do not match', $message)); } - public function dataFormatTip(): iterable + public static function dataFormatTip(): iterable { yield ['tip', 'tip']; yield ['%configurationFile%', '%configurationFile%']; diff --git a/tests/PHPStan/Command/ErrorFormatter/JunitErrorFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/JunitErrorFormatterTest.php index f83f162bb2..dfdc755e9a 100644 --- a/tests/PHPStan/Command/ErrorFormatter/JunitErrorFormatterTest.php +++ b/tests/PHPStan/Command/ErrorFormatter/JunitErrorFormatterTest.php @@ -22,7 +22,7 @@ public function setUp(): void /** * @return Generator> */ - public function dataFormatterOutputProvider(): Generator + public static function dataFormatterOutputProvider(): Generator { yield 'No errors' => [ 0, diff --git a/tests/PHPStan/Command/ErrorFormatter/RawErrorFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/RawErrorFormatterTest.php index ffe1c436d3..117645e0b7 100644 --- a/tests/PHPStan/Command/ErrorFormatter/RawErrorFormatterTest.php +++ b/tests/PHPStan/Command/ErrorFormatter/RawErrorFormatterTest.php @@ -8,7 +8,7 @@ class RawErrorFormatterTest extends ErrorFormatterTestCase { - public function dataFormatterOutputProvider(): iterable + public static function dataFormatterOutputProvider(): iterable { yield [ 'message' => 'No errors', diff --git a/tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php index 4515aefa07..8e15865dd9 100644 --- a/tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php +++ b/tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php @@ -26,7 +26,7 @@ protected function tearDown(): void putenv('TERM_PROGRAM'); } - public function dataFormatterOutputProvider(): iterable + public static function dataFormatterOutputProvider(): iterable { yield [ 'message' => 'No errors', diff --git a/tests/PHPStan/Command/ErrorFormatter/TeamcityErrorFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/TeamcityErrorFormatterTest.php index 6543fbae67..e74d1354d4 100644 --- a/tests/PHPStan/Command/ErrorFormatter/TeamcityErrorFormatterTest.php +++ b/tests/PHPStan/Command/ErrorFormatter/TeamcityErrorFormatterTest.php @@ -10,7 +10,7 @@ class TeamcityErrorFormatterTest extends ErrorFormatterTestCase { - public function dataFormatterOutputProvider(): iterable + public static function dataFormatterOutputProvider(): iterable { yield [ 'No errors', diff --git a/tests/PHPStan/File/FileExcluderTest.php b/tests/PHPStan/File/FileExcluderTest.php index 3c2d150290..a81740afba 100644 --- a/tests/PHPStan/File/FileExcluderTest.php +++ b/tests/PHPStan/File/FileExcluderTest.php @@ -24,7 +24,7 @@ public function testFilesAreExcludedFromAnalysingOnWindows( $this->assertSame($isExcluded, $fileExcluder->isExcludedFromAnalysing($filePath)); } - public function dataExcludeOnWindows(): array + public static function dataExcludeOnWindows(): array { return [ [ @@ -132,7 +132,7 @@ public function testFilesAreExcludedFromAnalysingOnUnix( $this->assertSame($isExcluded, $fileExcluder->isExcludedFromAnalysing($filePath)); } - public function dataExcludeOnUnix(): array + public static function dataExcludeOnUnix(): array { return [ [ @@ -203,7 +203,7 @@ public function dataExcludeOnUnix(): array ]; } - public function dataNoImplicitWildcard(): iterable + public static function dataNoImplicitWildcard(): iterable { yield [ __DIR__ . '/tests/foo.php', diff --git a/tests/PHPStan/File/FileHelperTest.php b/tests/PHPStan/File/FileHelperTest.php index 409936a8d1..285f6f3a0e 100644 --- a/tests/PHPStan/File/FileHelperTest.php +++ b/tests/PHPStan/File/FileHelperTest.php @@ -10,7 +10,7 @@ class FileHelperTest extends PHPStanTestCase /** * @return string[][] */ - public function dataAbsolutizePathOnWindows(): array + public static function dataAbsolutizePathOnWindows(): array { return [ ['C:/Program Files', 'C:/Program Files'], @@ -38,7 +38,7 @@ public function testAbsolutizePathOnWindows(string $path, string $absolutePath): /** * @return string[][] */ - public function dataAbsolutizePathOnLinuxOrMac(): array + public static function dataAbsolutizePathOnLinuxOrMac(): array { return [ ['C:/Program Files', '/abcd/C:/Program Files'], @@ -67,7 +67,7 @@ public function testAbsolutizePathOnLinuxOrMac(string $path, string $absolutePat /** * @return string[][] */ - public function dataNormalizePathOnWindows(): array + public static function dataNormalizePathOnWindows(): array { return [ ['C:/Program Files/PHP', 'C:\Program Files\PHP'], @@ -93,7 +93,7 @@ public function testNormalizePathOnWindows(string $path, string $normalizedPath) /** * @return string[][] */ - public function dataNormalizePathOnLinuxOrMac(): array + public static function dataNormalizePathOnLinuxOrMac(): array { return [ ['C:\Program Files\PHP', 'C:/Program Files/PHP'], diff --git a/tests/PHPStan/File/ParentDirectoryRelativePathHelperTest.php b/tests/PHPStan/File/ParentDirectoryRelativePathHelperTest.php index d4065efb28..3a409211b4 100644 --- a/tests/PHPStan/File/ParentDirectoryRelativePathHelperTest.php +++ b/tests/PHPStan/File/ParentDirectoryRelativePathHelperTest.php @@ -7,7 +7,7 @@ class ParentDirectoryRelativePathHelperTest extends TestCase { - public function dataGetRelativePath(): array + public static function dataGetRelativePath(): array { return [ [ diff --git a/tests/PHPStan/File/RelativePathHelperTest.php b/tests/PHPStan/File/RelativePathHelperTest.php index 5d5b3eca41..43e2ed52fa 100644 --- a/tests/PHPStan/File/RelativePathHelperTest.php +++ b/tests/PHPStan/File/RelativePathHelperTest.php @@ -10,7 +10,7 @@ class RelativePathHelperTest extends TestCase { - public function dataGetRelativePath(): array + public static function dataGetRelativePath(): array { return [ [ @@ -222,7 +222,7 @@ public function testGetRelativePathOnWindows( ); } - public function dataGetRelativePathWindowsSpecific(): array + public static function dataGetRelativePathWindowsSpecific(): array { return [ [ diff --git a/tests/PHPStan/Generics/TemplateTypeFactoryTest.php b/tests/PHPStan/Generics/TemplateTypeFactoryTest.php index 58af77cd3b..a5f966e305 100644 --- a/tests/PHPStan/Generics/TemplateTypeFactoryTest.php +++ b/tests/PHPStan/Generics/TemplateTypeFactoryTest.php @@ -21,7 +21,7 @@ class TemplateTypeFactoryTest extends PHPStanTestCase { /** @return array */ - public function dataCreate(): array + public static function dataCreate(): array { return [ [ diff --git a/tests/PHPStan/Node/AttributeArgRuleTest.php b/tests/PHPStan/Node/AttributeArgRuleTest.php index fb4c1d99e9..37c6f98df1 100644 --- a/tests/PHPStan/Node/AttributeArgRuleTest.php +++ b/tests/PHPStan/Node/AttributeArgRuleTest.php @@ -21,7 +21,7 @@ protected function getRule(): Rule return new AttributeArgRule(); } - public function dataRule(): iterable + public static function dataRule(): iterable { yield [ __DIR__ . '/data/attributes.php', diff --git a/tests/PHPStan/Node/AttributeGroupRuleTest.php b/tests/PHPStan/Node/AttributeGroupRuleTest.php index d1e3044f44..07d6ed9e2d 100644 --- a/tests/PHPStan/Node/AttributeGroupRuleTest.php +++ b/tests/PHPStan/Node/AttributeGroupRuleTest.php @@ -20,7 +20,7 @@ protected function getRule(): Rule return new AttributeGroupRule(); } - public function dataRule(): iterable + public static function dataRule(): iterable { yield [ __DIR__ . '/data/attributes.php', diff --git a/tests/PHPStan/Node/AttributeRuleTest.php b/tests/PHPStan/Node/AttributeRuleTest.php index 3b189a210d..52b4c55d65 100644 --- a/tests/PHPStan/Node/AttributeRuleTest.php +++ b/tests/PHPStan/Node/AttributeRuleTest.php @@ -20,7 +20,7 @@ protected function getRule(): Rule return new AttributeRule(); } - public function dataRule(): iterable + public static function dataRule(): iterable { yield [ __DIR__ . '/data/attributes.php', diff --git a/tests/PHPStan/Node/FileNodeTest.php b/tests/PHPStan/Node/FileNodeTest.php index 60a132a7f8..47856f6e04 100644 --- a/tests/PHPStan/Node/FileNodeTest.php +++ b/tests/PHPStan/Node/FileNodeTest.php @@ -51,7 +51,7 @@ public function processNode(Node $node, Scope $scope): array }; } - public function dataRule(): iterable + public static function dataRule(): iterable { yield [ __DIR__ . '/data/empty.php', diff --git a/tests/PHPStan/Parallel/ParallelAnalyserIntegrationTest.php b/tests/PHPStan/Parallel/ParallelAnalyserIntegrationTest.php index 91f0e9544c..77e1a2000d 100644 --- a/tests/PHPStan/Parallel/ParallelAnalyserIntegrationTest.php +++ b/tests/PHPStan/Parallel/ParallelAnalyserIntegrationTest.php @@ -24,7 +24,7 @@ class ParallelAnalyserIntegrationTest extends TestCase { - public function dataRun(): array + public static function dataRun(): array { return [ ['analyse'], diff --git a/tests/PHPStan/Parallel/SchedulerTest.php b/tests/PHPStan/Parallel/SchedulerTest.php index fb1fd626cf..375ec004f7 100644 --- a/tests/PHPStan/Parallel/SchedulerTest.php +++ b/tests/PHPStan/Parallel/SchedulerTest.php @@ -10,7 +10,7 @@ class SchedulerTest extends TestCase { - public function dataSchedule(): array + public static function dataSchedule(): array { return [ [ diff --git a/tests/PHPStan/Parser/CachedParserTest.php b/tests/PHPStan/Parser/CachedParserTest.php index 1c60d896b3..ad7c18a52e 100644 --- a/tests/PHPStan/Parser/CachedParserTest.php +++ b/tests/PHPStan/Parser/CachedParserTest.php @@ -47,7 +47,7 @@ public function testParseFileClearCache( ); } - public function dataParseFileClearCache(): Generator + public static function dataParseFileClearCache(): Generator { yield 'even' => [ 'cachedNodesByStringCountMax' => 50, diff --git a/tests/PHPStan/Parser/CleaningParserTest.php b/tests/PHPStan/Parser/CleaningParserTest.php index 69c0e8af10..fc54ad5e28 100644 --- a/tests/PHPStan/Parser/CleaningParserTest.php +++ b/tests/PHPStan/Parser/CleaningParserTest.php @@ -14,7 +14,7 @@ class CleaningParserTest extends PHPStanTestCase { - public function dataParse(): iterable + public static function dataParse(): iterable { return [ [ diff --git a/tests/PHPStan/Parser/ParserTest.php b/tests/PHPStan/Parser/ParserTest.php index 94fe9a406b..633beff241 100644 --- a/tests/PHPStan/Parser/ParserTest.php +++ b/tests/PHPStan/Parser/ParserTest.php @@ -12,7 +12,7 @@ class ParserTest extends PHPStanTestCase { - public function dataVariadicCallLikes(): iterable + public static function dataVariadicCallLikes(): iterable { yield [ __DIR__ . '/data/variadic-functions.php', diff --git a/tests/PHPStan/Parser/RichParserTest.php b/tests/PHPStan/Parser/RichParserTest.php index 0bc0b3b4c1..eb067b0f54 100644 --- a/tests/PHPStan/Parser/RichParserTest.php +++ b/tests/PHPStan/Parser/RichParserTest.php @@ -8,7 +8,7 @@ class RichParserTest extends PHPStanTestCase { - public function dataLinesToIgnore(): iterable + public static function dataLinesToIgnore(): iterable { yield [ 'assertSame($expectedLines, $lines); } - public function dataLinesToIgnoreParseErrors(): iterable + public static function dataLinesToIgnoreParseErrors(): iterable { yield [ 'gatherAssertTypes(__DIR__ . '/data/allowed-sub-types.php'); + yield from self::gatherAssertTypes(__DIR__ . '/data/allowed-sub-types.php'); } /** diff --git a/tests/PHPStan/Reflection/Annotations/AnnotationsMethodsClassReflectionExtensionTest.php b/tests/PHPStan/Reflection/Annotations/AnnotationsMethodsClassReflectionExtensionTest.php index 36b4402d9e..325bd25e36 100644 --- a/tests/PHPStan/Reflection/Annotations/AnnotationsMethodsClassReflectionExtensionTest.php +++ b/tests/PHPStan/Reflection/Annotations/AnnotationsMethodsClassReflectionExtensionTest.php @@ -19,7 +19,7 @@ class AnnotationsMethodsClassReflectionExtensionTest extends PHPStanTestCase { - public function dataMethods(): array + public static function dataMethods(): array { $fooMethods = [ 'getInteger' => [ @@ -963,7 +963,7 @@ public function dataMethods(): array */ public function testMethods(string $className, array $methods): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $scope = $this->createMock(Scope::class); $scope->method('isInClass')->willReturn(true); @@ -1025,7 +1025,7 @@ public function testMethods(string $className, array $methods): void public function testOverridingNativeMethodsWithAnnotationsDoesNotBreakGetNativeMethod(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass(Bar::class); $this->assertTrue($class->hasNativeMethod('overridenMethodWithAnnotation')); $this->assertInstanceOf(PhpMethodReflection::class, $class->getNativeMethod('overridenMethodWithAnnotation')); diff --git a/tests/PHPStan/Reflection/Annotations/AnnotationsPropertiesClassReflectionExtensionTest.php b/tests/PHPStan/Reflection/Annotations/AnnotationsPropertiesClassReflectionExtensionTest.php index 35d8075f8b..fd98a90115 100644 --- a/tests/PHPStan/Reflection/Annotations/AnnotationsPropertiesClassReflectionExtensionTest.php +++ b/tests/PHPStan/Reflection/Annotations/AnnotationsPropertiesClassReflectionExtensionTest.php @@ -16,7 +16,7 @@ class AnnotationsPropertiesClassReflectionExtensionTest extends PHPStanTestCase { - public function dataProperties(): array + public static function dataProperties(): array { return [ [ @@ -277,7 +277,7 @@ public function dataProperties(): array */ public function testProperties(string $className, array $properties): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $scope = $this->createMock(Scope::class); $scope->method('isInClass')->willReturn(true); @@ -322,7 +322,7 @@ public function testProperties(string $className, array $properties): void public function testOverridingNativePropertiesWithAnnotationsDoesNotBreakGetNativeProperty(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass(Bar::class); $this->assertTrue($class->hasNativeProperty('overridenPropertyWithAnnotation')); $this->assertSame('AnnotationsProperties\Foo', $class->getNativeProperty('overridenPropertyWithAnnotation')->getReadableType()->describe(VerbosityLevel::precise())); diff --git a/tests/PHPStan/Reflection/Annotations/DeprecatedAnnotationsTest.php b/tests/PHPStan/Reflection/Annotations/DeprecatedAnnotationsTest.php index 48c4197868..73ca640269 100644 --- a/tests/PHPStan/Reflection/Annotations/DeprecatedAnnotationsTest.php +++ b/tests/PHPStan/Reflection/Annotations/DeprecatedAnnotationsTest.php @@ -21,7 +21,7 @@ class DeprecatedAnnotationsTest extends PHPStanTestCase { - public function dataDeprecatedAnnotations(): array + public static function dataDeprecatedAnnotations(): array { return [ [ @@ -93,7 +93,7 @@ public function dataDeprecatedAnnotations(): array */ public function testDeprecatedAnnotations(bool $deprecated, string $className, ?string $classDeprecation, array $deprecatedAnnotations): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $scope = $this->createMock(Scope::class); $scope->method('isInClass')->willReturn(true); @@ -128,7 +128,7 @@ public function testDeprecatedUserFunctions(): void { require_once __DIR__ . '/data/annotations-deprecated.php'; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $this->assertFalse($reflectionProvider->getFunction(new Name\FullyQualified('DeprecatedAnnotations\foo'), null)->isDeprecated()->yes()); $this->assertTrue($reflectionProvider->getFunction(new Name\FullyQualified('DeprecatedAnnotations\deprecatedFoo'), null)->isDeprecated()->yes()); @@ -136,7 +136,7 @@ public function testDeprecatedUserFunctions(): void public function testNonDeprecatedNativeFunctions(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $this->assertFalse($reflectionProvider->getFunction(new Name('str_replace'), null)->isDeprecated()->yes()); $this->assertFalse($reflectionProvider->getFunction(new Name('get_class'), null)->isDeprecated()->yes()); @@ -145,21 +145,21 @@ public function testNonDeprecatedNativeFunctions(): void public function testDeprecatedMethodsFromInterface(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass(DeprecatedBar::class); $this->assertTrue($class->getNativeMethod('superDeprecated')->isDeprecated()->yes()); } public function testNotDeprecatedChildMethods(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $this->assertTrue($reflectionProvider->getClass(BazInterface::class)->getNativeMethod('superDeprecated')->isDeprecated()->yes()); $this->assertTrue($reflectionProvider->getClass(SubBazInterface::class)->getNativeMethod('superDeprecated')->isDeprecated()->no()); $this->assertTrue($reflectionProvider->getClass(Baz::class)->getNativeMethod('superDeprecated')->isDeprecated()->no()); } - public function dataDeprecatedAttributeAboveFunction(): iterable + public static function dataDeprecatedAttributeAboveFunction(): iterable { yield [ 'DeprecatedAttributeFunctions\\notDeprecated', @@ -197,13 +197,13 @@ public function testDeprecatedAttributeAboveFunction(string $functionName, Trina { require_once __DIR__ . '/data/deprecated-attribute-functions.php'; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $function = $reflectionProvider->getFunction(new Name($functionName), null); $this->assertSame($isDeprecated->describe(), $function->isDeprecated()->describe()); $this->assertSame($deprecatedDescription, $function->getDeprecatedDescription()); } - public function dataDeprecatedAttributeAboveMethod(): iterable + public static function dataDeprecatedAttributeAboveMethod(): iterable { yield [ FooWithMethods::class, @@ -236,14 +236,14 @@ public function dataDeprecatedAttributeAboveMethod(): iterable */ public function testDeprecatedAttributeAboveMethod(string $className, string $methodName, TrinaryLogic $isDeprecated, ?string $deprecatedDescription): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $method = $class->getNativeMethod($methodName); $this->assertSame($isDeprecated->describe(), $method->isDeprecated()->describe()); $this->assertSame($deprecatedDescription, $method->getDeprecatedDescription()); } - public function dataDeprecatedAttributeAboveClassConstant(): iterable + public static function dataDeprecatedAttributeAboveClassConstant(): iterable { yield [ FooWithConstants::class, @@ -299,14 +299,14 @@ public function dataDeprecatedAttributeAboveClassConstant(): iterable */ public function testDeprecatedAttributeAboveClassConstant(string $className, string $constantName, TrinaryLogic $isDeprecated, ?string $deprecatedDescription): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $constant = $class->getConstant($constantName); $this->assertSame($isDeprecated->describe(), $constant->isDeprecated()->describe()); $this->assertSame($deprecatedDescription, $constant->getDeprecatedDescription()); } - public function dataDeprecatedAttributeAboveEnumCase(): iterable + public static function dataDeprecatedAttributeAboveEnumCase(): iterable { yield [ 'DeprecatedAttributeEnum\\EnumWithDeprecatedCases', @@ -337,14 +337,14 @@ public function testDeprecatedAttributeAboveEnumCase(string $className, string $ $this->markTestSkipped('Test requires PHP 8.1.'); } - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $case = $class->getEnumCase($caseName); $this->assertSame($isDeprecated->describe(), $case->isDeprecated()->describe()); $this->assertSame($deprecatedDescription, $case->getDeprecatedDescription()); } - public function dataDeprecatedAttributeAbovePropertyHook(): iterable + public static function dataDeprecatedAttributeAbovePropertyHook(): iterable { yield [ 'DeprecatedAttributePropertyHooks\\Foo', @@ -393,7 +393,7 @@ public function testDeprecatedAttributeAbovePropertyHook(string $className, stri $this->markTestSkipped('Test requires PHP 8.4.'); } - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $property = $class->getNativeProperty($propertyName); $hook = $property->getHook($hookName); diff --git a/tests/PHPStan/Reflection/Annotations/FinalAnnotationsTest.php b/tests/PHPStan/Reflection/Annotations/FinalAnnotationsTest.php index 77b9d3e008..dd259efe7d 100644 --- a/tests/PHPStan/Reflection/Annotations/FinalAnnotationsTest.php +++ b/tests/PHPStan/Reflection/Annotations/FinalAnnotationsTest.php @@ -10,7 +10,7 @@ class FinalAnnotationsTest extends PHPStanTestCase { - public function dataFinalAnnotations(): array + public static function dataFinalAnnotations(): array { return [ [ @@ -42,7 +42,7 @@ public function dataFinalAnnotations(): array */ public function testFinalAnnotations(bool $final, string $className, array $finalAnnotations): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $scope = $this->createMock(Scope::class); $scope->method('isInClass')->willReturn(true); diff --git a/tests/PHPStan/Reflection/Annotations/InternalAnnotationsTest.php b/tests/PHPStan/Reflection/Annotations/InternalAnnotationsTest.php index d7af0d248f..330953011b 100644 --- a/tests/PHPStan/Reflection/Annotations/InternalAnnotationsTest.php +++ b/tests/PHPStan/Reflection/Annotations/InternalAnnotationsTest.php @@ -15,7 +15,7 @@ class InternalAnnotationsTest extends PHPStanTestCase { - public function dataInternalAnnotations(): array + public static function dataInternalAnnotations(): array { return [ [ @@ -115,7 +115,7 @@ public function dataInternalAnnotations(): array */ public function testInternalAnnotations(bool $internal, string $className, array $internalAnnotations): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $scope = $this->createMock(Scope::class); $scope->method('isInClass')->willReturn(true); @@ -146,7 +146,7 @@ public function testInternalUserFunctions(): void { require_once __DIR__ . '/data/annotations-internal.php'; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $this->assertFalse($reflectionProvider->getFunction(new Name\FullyQualified('InternalAnnotations\foo'), null)->isInternal()->yes()); $this->assertTrue($reflectionProvider->getFunction(new Name\FullyQualified('InternalAnnotations\internalFoo'), null)->isInternal()->yes()); diff --git a/tests/PHPStan/Reflection/Annotations/ThrowsAnnotationsTest.php b/tests/PHPStan/Reflection/Annotations/ThrowsAnnotationsTest.php index 7e3f56b299..eac3643c92 100644 --- a/tests/PHPStan/Reflection/Annotations/ThrowsAnnotationsTest.php +++ b/tests/PHPStan/Reflection/Annotations/ThrowsAnnotationsTest.php @@ -16,7 +16,7 @@ class ThrowsAnnotationsTest extends PHPStanTestCase { - public function dataThrowsAnnotations(): array + public static function dataThrowsAnnotations(): array { return [ [ @@ -73,7 +73,7 @@ public function dataThrowsAnnotations(): array */ public function testThrowsAnnotations(string $className, array $throwsAnnotations): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $scope = $this->createMock(Scope::class); @@ -88,7 +88,7 @@ public function testThrowsOnUserFunctions(): void { require_once __DIR__ . '/data/annotations-throws.php'; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $this->assertNull($reflectionProvider->getFunction(new Name\FullyQualified('ThrowsAnnotations\withoutThrows'), null)->getThrowType()); diff --git a/tests/PHPStan/Reflection/AttributeReflectionTest.php b/tests/PHPStan/Reflection/AttributeReflectionTest.php index f0c22f45ec..65390743bb 100644 --- a/tests/PHPStan/Reflection/AttributeReflectionTest.php +++ b/tests/PHPStan/Reflection/AttributeReflectionTest.php @@ -13,9 +13,9 @@ class AttributeReflectionTest extends PHPStanTestCase { - public function dataAttributeReflections(): iterable + public static function dataAttributeReflections(): iterable { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); yield [ $reflectionProvider->getFunction(new Name('AttributeReflectionTest\\myFunction'), null)->getAttributes(), diff --git a/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorTest.php b/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorTest.php index 8ea1afae71..60bbd33ed0 100644 --- a/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorTest.php +++ b/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorTest.php @@ -17,7 +17,7 @@ class OptimizedDirectorySourceLocatorTest extends PHPStanTestCase { - public function dataClass(): iterable + public static function dataClass(): iterable { yield from [ [ @@ -84,7 +84,7 @@ public function testClass(string $className, string $expectedClassName, string $ $this->assertSame($file, basename($classReflection->getFileName())); } - public function dataFunctionExists(): array + public static function dataFunctionExists(): array { return [ [ @@ -144,7 +144,7 @@ public function testFunctionExists(string $functionName, string $expectedFunctio $this->assertSame($file, basename($functionReflection->getFileName())); } - public function dataConstant(): iterable + public static function dataConstant(): iterable { yield from [ [ @@ -290,7 +290,7 @@ public function testLocateIdentifiersByType(): void ], $actualConstants); } - public function dataFunctionDoesNotExist(): array + public static function dataFunctionDoesNotExist(): array { return [ ['doFoo'], diff --git a/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorTest.php b/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorTest.php index 80b588643f..0a918f64f0 100644 --- a/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorTest.php +++ b/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorTest.php @@ -18,7 +18,7 @@ class OptimizedSingleFileSourceLocatorTest extends PHPStanTestCase { - public function dataClass(): iterable + public static function dataClass(): iterable { yield from [ [ @@ -54,7 +54,7 @@ public function dataClass(): iterable ]; } - public function dataForIdenifiersByType(): iterable + public static function dataForIdenifiersByType(): iterable { yield from [ 'classes wrapped in conditions' => [ @@ -139,7 +139,7 @@ public function testClass(string $className, string $expectedClassName, string $ $this->assertSame($expectedClassName, $classReflection->getName()); } - public function dataFunction(): array + public static function dataFunction(): array { return [ [ @@ -177,7 +177,7 @@ public function testFunction(string $functionName, string $expectedFunctionName, $this->assertSame($expectedFunctionName, $functionReflection->getName()); } - public function dataConst(): array + public static function dataConst(): array { return [ [ @@ -222,7 +222,7 @@ public function testConst(string $constantName, string $valueTypeDescription): v $this->assertSame($valueTypeDescription, $valueType->describe(VerbosityLevel::precise())); } - public function dataConstUnknown(): array + public static function dataConstUnknown(): array { return [ ['TEST_VARIABLE'], diff --git a/tests/PHPStan/Reflection/ClassReflectionTest.php b/tests/PHPStan/Reflection/ClassReflectionTest.php index b4d2fa5eb4..368b533302 100644 --- a/tests/PHPStan/Reflection/ClassReflectionTest.php +++ b/tests/PHPStan/Reflection/ClassReflectionTest.php @@ -43,7 +43,7 @@ class ClassReflectionTest extends PHPStanTestCase { - public function dataHasTraitUse(): array + public static function dataHasTraitUse(): array { return [ [Foo::class, true], @@ -58,12 +58,12 @@ public function dataHasTraitUse(): array */ public function testHasTraitUse(string $className, bool $has): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $classReflection = $reflectionProvider->getClass($className); $this->assertSame($has, $classReflection->hasTraitUse(FooTrait::class)); } - public function dataClassHierarchyDistances(): array + public static function dataClassHierarchyDistances(): array { return [ [ @@ -105,7 +105,7 @@ public function testClassHierarchyDistances( array $expectedDistances, ): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $classReflection = $reflectionProvider->getClass($class); $this->assertSame( $expectedDistances, @@ -115,7 +115,7 @@ public function testClassHierarchyDistances( public function testVariadicTraitMethod(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $fooReflection = $reflectionProvider->getClass(Foo::class); $variadicMethod = $fooReflection->getNativeMethod('variadicMethod'); $methodVariant = $variadicMethod->getOnlyVariant(); @@ -124,7 +124,7 @@ public function testVariadicTraitMethod(): void public function testGenericInheritance(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $reflection = $reflectionProvider->getClass(C::class); $this->assertSame('GenericInheritance\\C', $reflection->getDisplayName()); @@ -143,12 +143,12 @@ public function testGenericInheritance(): void public function testIsGenericWithStubPhpDoc(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $reflection = $reflectionProvider->getClass(ReflectionClass::class); $this->assertTrue($reflection->isGeneric()); } - public function dataIsAttributeClass(): array + public static function dataIsAttributeClass(): array { return [ [ @@ -177,7 +177,7 @@ public function dataIsAttributeClass(): array */ public function testIsAttributeClass(string $className, bool $expected, int $expectedFlags = Attribute::TARGET_ALL): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $reflection = $reflectionProvider->getClass($className); $this->assertSame($expected, $reflection->isAttributeClass()); if (!$expected) { @@ -188,7 +188,7 @@ public function testIsAttributeClass(string $className, bool $expected, int $exp public function testDeprecatedConstantFromAnotherFile(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $reflection = $reflectionProvider->getClass(SecuredRouter::class); $constant = $reflection->getConstant('SECURED'); $this->assertTrue($constant->isDeprecated()->yes()); @@ -201,7 +201,7 @@ public function testDeprecatedConstantFromAnotherFile(): void */ public function testGetTraits(string $className, array $expected, bool $recursive): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $this->assertSame( array_map( @@ -212,7 +212,7 @@ public function testGetTraits(string $className, array $expected, bool $recursiv ); } - public function dataNestedRecursiveTraits(): array + public static function dataNestedRecursiveTraits(): array { return [ [ @@ -293,7 +293,7 @@ public function testEnumIsFinal(): void $this->markTestSkipped('Test requires PHP 8.1.'); } - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $enum = $reflectionProvider->getClass('PHPStan\Fixture\TestEnum'); $this->assertTrue($enum->isEnum()); $this->assertInstanceOf('ReflectionEnum', $enum->getNativeReflection()); // @phpstan-ignore-line Exact error differs on PHP 7.4 and others @@ -307,7 +307,7 @@ public function testBackedEnumType(): void $this->markTestSkipped('Test requires PHP 8.1.'); } - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $enum = $reflectionProvider->getClass('PHPStan\Fixture\TestEnum'); $this->assertInstanceOf(IntegerType::class, $enum->getBackedEnumType()); } @@ -316,7 +316,7 @@ public function testIs(): void { $className = static::class; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $classReflection = $reflectionProvider->getClass($className); $this->assertTrue($classReflection->is($className)); @@ -325,13 +325,13 @@ public function testIs(): void $this->assertFalse($classReflection->is(RuleTestCase::class)); } - public function dataPropertyHooks(): iterable + public static function dataPropertyHooks(): iterable { if (PHP_VERSION_ID < 80400) { return; } - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); yield [ $reflectionProvider->getClass('PropertyHooksTypes\\Foo'), diff --git a/tests/PHPStan/Reflection/Constant/RuntimeConstantReflectionTest.php b/tests/PHPStan/Reflection/Constant/RuntimeConstantReflectionTest.php index 77d575716e..6d5e489c57 100644 --- a/tests/PHPStan/Reflection/Constant/RuntimeConstantReflectionTest.php +++ b/tests/PHPStan/Reflection/Constant/RuntimeConstantReflectionTest.php @@ -10,7 +10,7 @@ class RuntimeConstantReflectionTest extends PHPStanTestCase { - public function dataDeprecatedConstants(): iterable + public static function dataDeprecatedConstants(): iterable { yield [ new Name('\FILTER_SANITIZE_STRING'), @@ -48,7 +48,7 @@ public function testDeprecatedConstants(Name $constName, TrinaryLogic $isDepreca { require_once __DIR__ . '/data/deprecated-constant.php'; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $this->assertTrue($reflectionProvider->hasConstant($constName, null)); $this->assertSame($isDeprecated->describe(), $reflectionProvider->getConstant($constName, null)->isDeprecated()->describe()); diff --git a/tests/PHPStan/Reflection/FunctionReflectionTest.php b/tests/PHPStan/Reflection/FunctionReflectionTest.php index 9f0780f113..f8f775f040 100644 --- a/tests/PHPStan/Reflection/FunctionReflectionTest.php +++ b/tests/PHPStan/Reflection/FunctionReflectionTest.php @@ -11,7 +11,7 @@ class FunctionReflectionTest extends PHPStanTestCase { - public function dataPhpdocFunctions(): iterable + public static function dataPhpdocFunctions(): iterable { yield [ 'FunctionReflectionDocTest\\myFunction', @@ -44,13 +44,13 @@ public function testFunctionHasPhpdoc(string $functionName, ?string $expectedDoc { require_once __DIR__ . '/data/function-with-phpdoc.php'; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $functionReflection = $reflectionProvider->getFunction(new Node\Name($functionName), null); $this->assertSame($expectedDoc, $functionReflection->getDocComment()); } - public function dataPhpdocMethods(): iterable + public static function dataPhpdocMethods(): iterable { yield [ 'FunctionReflectionDocTest\\ClassWithPhpdoc', @@ -119,7 +119,7 @@ public function dataPhpdocMethods(): iterable */ public function testMethodHasPhpdoc(string $className, string $methodName, ?string $expectedDocComment): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $scope = $this->createMock(Scope::class); $scope->method('isInClass')->willReturn(true); @@ -133,7 +133,7 @@ public function testMethodHasPhpdoc(string $className, string $methodName, ?stri $this->assertSame($expectedDocComment, $methodReflection->getDocComment()); } - public function dataFunctionReturnsByReference(): iterable + public static function dataFunctionReturnsByReference(): iterable { yield ['\\implode', TrinaryLogic::createNo()]; @@ -149,13 +149,13 @@ public function testFunctionReturnsByReference(string $functionName, TrinaryLogi { require_once __DIR__ . '/data/returns-by-reference.php'; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $functionReflection = $reflectionProvider->getFunction(new Node\Name($functionName), null); $this->assertSame($expectedReturnsByRef, $functionReflection->returnsByReference()); } - public function dataMethodReturnsByReference(): iterable + public static function dataMethodReturnsByReference(): iterable { yield ['ReturnsByReference\\X', 'foo', TrinaryLogic::createNo()]; yield ['ReturnsByReference\\X', 'refFoo', TrinaryLogic::createYes()]; @@ -182,7 +182,7 @@ public function dataMethodReturnsByReference(): iterable */ public function testMethodReturnsByReference(string $className, string $methodName, TrinaryLogic $expectedReturnsByRef): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $scope = $this->createMock(Scope::class); $scope->method('isInClass')->willReturn(true); diff --git a/tests/PHPStan/Reflection/GenericParametersAcceptorResolverTest.php b/tests/PHPStan/Reflection/GenericParametersAcceptorResolverTest.php index 94306bc0ec..fd935373e4 100644 --- a/tests/PHPStan/Reflection/GenericParametersAcceptorResolverTest.php +++ b/tests/PHPStan/Reflection/GenericParametersAcceptorResolverTest.php @@ -27,7 +27,7 @@ class GenericParametersAcceptorResolverTest extends PHPStanTestCase /** * @return array */ - public function dataResolve(): array + public static function dataResolve(): array { $templateType = static fn ($name, ?Type $type = null): Type => TemplateTypeFactory::create( TemplateTypeScope::createWithFunction('a'), diff --git a/tests/PHPStan/Reflection/InitializerExprTypeResolverTest.php b/tests/PHPStan/Reflection/InitializerExprTypeResolverTest.php index 9288f62e8d..f1d26f0240 100644 --- a/tests/PHPStan/Reflection/InitializerExprTypeResolverTest.php +++ b/tests/PHPStan/Reflection/InitializerExprTypeResolverTest.php @@ -14,7 +14,7 @@ class InitializerExprTypeResolverTest extends PHPStanTestCase { - public function dataExplicitNever(): iterable + public static function dataExplicitNever(): iterable { yield [ new LNumber(1), diff --git a/tests/PHPStan/Reflection/MixedTypeTest.php b/tests/PHPStan/Reflection/MixedTypeTest.php index 6ccc847d84..0d30fc39b8 100644 --- a/tests/PHPStan/Reflection/MixedTypeTest.php +++ b/tests/PHPStan/Reflection/MixedTypeTest.php @@ -17,7 +17,7 @@ public function testMixedType(): void self::markTestSkipped('Test requires PHP 8.0.'); } - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass(Foo::class); $propertyType = $class->getNativeProperty('fooProp')->getNativeType(); $this->assertInstanceOf(MixedType::class, $propertyType); diff --git a/tests/PHPStan/Reflection/ParametersAcceptorSelectorTest.php b/tests/PHPStan/Reflection/ParametersAcceptorSelectorTest.php index 1f2e534a45..8c0da7277c 100644 --- a/tests/PHPStan/Reflection/ParametersAcceptorSelectorTest.php +++ b/tests/PHPStan/Reflection/ParametersAcceptorSelectorTest.php @@ -33,10 +33,10 @@ class ParametersAcceptorSelectorTest extends PHPStanTestCase { - public function dataSelectFromTypes(): Generator + public static function dataSelectFromTypes(): Generator { require_once __DIR__ . '/data/function-definitions.php'; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $arrayRandVariants = $reflectionProvider->getFunction(new Name('array_rand'), null)->getVariants(); yield [ diff --git a/tests/PHPStan/Reflection/Php/UniversalObjectCratesClassReflectionExtensionTest.php b/tests/PHPStan/Reflection/Php/UniversalObjectCratesClassReflectionExtensionTest.php index dabd3948e0..9c2858aaea 100644 --- a/tests/PHPStan/Reflection/Php/UniversalObjectCratesClassReflectionExtensionTest.php +++ b/tests/PHPStan/Reflection/Php/UniversalObjectCratesClassReflectionExtensionTest.php @@ -13,7 +13,7 @@ class UniversalObjectCratesClassReflectionExtensionTest extends PHPStanTestCase public function testNonexistentClass(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $extension = new UniversalObjectCratesClassReflectionExtension( $reflectionProvider, ['NonexistentClass', 'stdClass'], @@ -26,7 +26,7 @@ public function testDifferentGetSetType(): void { require_once __DIR__ . '/data/universal-object-crates.php'; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $extension = new UniversalObjectCratesClassReflectionExtension( $reflectionProvider, ['UniversalObjectCreates\DifferentGetSetTypes'], @@ -52,7 +52,7 @@ public function testAnnotationOverrides(): void require_once __DIR__ . '/data/universal-object-crates-annotations.php'; $className = 'UniversalObjectCratesAnnotations\Model'; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $extension = new UniversalObjectCratesClassReflectionExtension( $reflectionProvider, [$className], diff --git a/tests/PHPStan/Reflection/ReflectionProviderTest.php b/tests/PHPStan/Reflection/ReflectionProviderTest.php index db8896c9cb..1e735312c6 100644 --- a/tests/PHPStan/Reflection/ReflectionProviderTest.php +++ b/tests/PHPStan/Reflection/ReflectionProviderTest.php @@ -14,7 +14,7 @@ class ReflectionProviderTest extends PHPStanTestCase { - public function dataFunctionThrowType(): iterable + public static function dataFunctionThrowType(): iterable { yield [ 'rand', @@ -56,7 +56,7 @@ public function dataFunctionThrowType(): iterable */ public function testFunctionThrowType(string $functionName, ?Type $expectedThrowType): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $function = $reflectionProvider->getFunction(new Name($functionName), null); $throwType = $function->getThrowType(); if ($expectedThrowType === null) { @@ -70,7 +70,7 @@ public function testFunctionThrowType(string $functionName, ?Type $expectedThrow ); } - public function dataFunctionDeprecated(): iterable + public static function dataFunctionDeprecated(): iterable { if (PHP_VERSION_ID < 80000) { yield 'create_function' => [ @@ -103,12 +103,12 @@ public function dataFunctionDeprecated(): iterable */ public function testFunctionDeprecated(string $functionName, bool $isDeprecated): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $function = $reflectionProvider->getFunction(new Name($functionName), null); $this->assertEquals(TrinaryLogic::createFromBoolean($isDeprecated), $function->isDeprecated()); } - public function dataMethodThrowType(): array + public static function dataMethodThrowType(): array { return [ [ @@ -129,7 +129,7 @@ public function dataMethodThrowType(): array */ public function testMethodThrowType(string $className, string $methodName, ?Type $expectedThrowType): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass($className); $method = $class->getNativeMethod($methodName); $throwType = $method->getThrowType(); @@ -152,7 +152,7 @@ public function testNativeClassConstantTypeInEvaledClass(): void eval('namespace NativeClassConstantInEvaledClass; class Foo { public const int FOO = 1; }'); - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass('NativeClassConstantInEvaledClass\\Foo'); $constant = $class->getConstant('FOO'); $this->assertSame('int', $constant->getValueType()->describe(VerbosityLevel::precise())); diff --git a/tests/PHPStan/Reflection/SignatureMap/Php8SignatureMapProviderTest.php b/tests/PHPStan/Reflection/SignatureMap/Php8SignatureMapProviderTest.php index 182a6582e9..99c5be4eb3 100644 --- a/tests/PHPStan/Reflection/SignatureMap/Php8SignatureMapProviderTest.php +++ b/tests/PHPStan/Reflection/SignatureMap/Php8SignatureMapProviderTest.php @@ -42,7 +42,7 @@ class Php8SignatureMapProviderTest extends PHPStanTestCase { - public function dataFunctions(): array + public static function dataFunctions(): array { return [ [ @@ -169,7 +169,7 @@ private function createProvider(): Php8SignatureMapProvider ); } - public function dataMethods(): array + public static function dataMethods(): array { return [ [ @@ -307,7 +307,7 @@ private function assertSignature( $this->assertSame($expectedVariadic, $actualSignature->isVariadic()); } - public function dataParseAll(): array + public static function dataParseAll(): array { $map = new Php8StubsMap(PHP_VERSION_ID); return array_map(static fn (string $file): array => [__DIR__ . '/../../../../vendor/phpstan/php-8-stubs/' . $file], array_merge($map->classes, $map->functions)); diff --git a/tests/PHPStan/Reflection/SignatureMap/SignatureMapParserTest.php b/tests/PHPStan/Reflection/SignatureMap/SignatureMapParserTest.php index 00ed1a4159..b4bb8924d4 100644 --- a/tests/PHPStan/Reflection/SignatureMap/SignatureMapParserTest.php +++ b/tests/PHPStan/Reflection/SignatureMap/SignatureMapParserTest.php @@ -39,9 +39,9 @@ class SignatureMapParserTest extends PHPStanTestCase { - public function dataGetFunctions(): array + public static function dataGetFunctions(): array { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return [ [ ['int', 'fp' => 'resource', 'fields' => 'array', 'delimiter=' => 'string', 'enclosure=' => 'string', 'escape_char=' => 'string'], @@ -482,7 +482,7 @@ public function testGetFunctions( ); } - public function dataParseAll(): array + public static function dataParseAll(): array { return [ [70400], diff --git a/tests/PHPStan/Reflection/UnionTypesTest.php b/tests/PHPStan/Reflection/UnionTypesTest.php index 79fb96b28a..8b72103e33 100644 --- a/tests/PHPStan/Reflection/UnionTypesTest.php +++ b/tests/PHPStan/Reflection/UnionTypesTest.php @@ -15,7 +15,7 @@ public function testUnionTypes(): void { require_once __DIR__ . '/../../../stubs/runtime/ReflectionUnionType.php'; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $class = $reflectionProvider->getClass(Foo::class); $propertyType = $class->getNativeProperty('fooProp')->getNativeType(); $this->assertInstanceOf(UnionType::class, $propertyType); diff --git a/tests/PHPStan/Rules/Api/ApiClassConstFetchRuleTest.php b/tests/PHPStan/Rules/Api/ApiClassConstFetchRuleTest.php index f5a0b797ab..b139a1ef2a 100644 --- a/tests/PHPStan/Rules/Api/ApiClassConstFetchRuleTest.php +++ b/tests/PHPStan/Rules/Api/ApiClassConstFetchRuleTest.php @@ -14,7 +14,7 @@ class ApiClassConstFetchRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ApiClassConstFetchRule(new ApiRuleHelper(), $this->createReflectionProvider()); + return new ApiClassConstFetchRule(new ApiRuleHelper(), self::createReflectionProvider()); } public function testRuleInPhpStan(): void diff --git a/tests/PHPStan/Rules/Api/ApiClassExtendsRuleTest.php b/tests/PHPStan/Rules/Api/ApiClassExtendsRuleTest.php index 26651b4e97..f62d2c2225 100644 --- a/tests/PHPStan/Rules/Api/ApiClassExtendsRuleTest.php +++ b/tests/PHPStan/Rules/Api/ApiClassExtendsRuleTest.php @@ -14,7 +14,7 @@ class ApiClassExtendsRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ApiClassExtendsRule(new ApiRuleHelper(), $this->createReflectionProvider()); + return new ApiClassExtendsRule(new ApiRuleHelper(), self::createReflectionProvider()); } public function testRuleInPhpStan(): void diff --git a/tests/PHPStan/Rules/Api/ApiClassImplementsRuleTest.php b/tests/PHPStan/Rules/Api/ApiClassImplementsRuleTest.php index e14d95f33e..2b0022ce56 100644 --- a/tests/PHPStan/Rules/Api/ApiClassImplementsRuleTest.php +++ b/tests/PHPStan/Rules/Api/ApiClassImplementsRuleTest.php @@ -14,7 +14,7 @@ class ApiClassImplementsRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ApiClassImplementsRule(new ApiRuleHelper(), $this->createReflectionProvider()); + return new ApiClassImplementsRule(new ApiRuleHelper(), self::createReflectionProvider()); } public function testRuleInPhpStan(): void diff --git a/tests/PHPStan/Rules/Api/ApiInstanceofRuleTest.php b/tests/PHPStan/Rules/Api/ApiInstanceofRuleTest.php index a22b102c63..edba6b82e1 100644 --- a/tests/PHPStan/Rules/Api/ApiInstanceofRuleTest.php +++ b/tests/PHPStan/Rules/Api/ApiInstanceofRuleTest.php @@ -14,7 +14,7 @@ class ApiInstanceofRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ApiInstanceofRule(new ApiRuleHelper(), $this->createReflectionProvider()); + return new ApiInstanceofRule(new ApiRuleHelper(), self::createReflectionProvider()); } public function testRuleInPhpStan(): void diff --git a/tests/PHPStan/Rules/Api/ApiInstanceofTypeRuleTest.php b/tests/PHPStan/Rules/Api/ApiInstanceofTypeRuleTest.php index e12f8aaf14..08ceeff3fd 100644 --- a/tests/PHPStan/Rules/Api/ApiInstanceofTypeRuleTest.php +++ b/tests/PHPStan/Rules/Api/ApiInstanceofTypeRuleTest.php @@ -13,7 +13,7 @@ class ApiInstanceofTypeRuleTest extends RuleTestCase public function getRule(): Rule { - return new ApiInstanceofTypeRule($this->createReflectionProvider()); + return new ApiInstanceofTypeRule(self::createReflectionProvider()); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Api/ApiInstantiationRuleTest.php b/tests/PHPStan/Rules/Api/ApiInstantiationRuleTest.php index 0d96c5a664..e2e968aadd 100644 --- a/tests/PHPStan/Rules/Api/ApiInstantiationRuleTest.php +++ b/tests/PHPStan/Rules/Api/ApiInstantiationRuleTest.php @@ -16,7 +16,7 @@ protected function getRule(): Rule { return new ApiInstantiationRule( new ApiRuleHelper(), - $this->createReflectionProvider(), + self::createReflectionProvider(), ); } diff --git a/tests/PHPStan/Rules/Api/ApiInterfaceExtendsRuleTest.php b/tests/PHPStan/Rules/Api/ApiInterfaceExtendsRuleTest.php index 770c59da3a..ee499665b8 100644 --- a/tests/PHPStan/Rules/Api/ApiInterfaceExtendsRuleTest.php +++ b/tests/PHPStan/Rules/Api/ApiInterfaceExtendsRuleTest.php @@ -14,7 +14,7 @@ class ApiInterfaceExtendsRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ApiInterfaceExtendsRule(new ApiRuleHelper(), $this->createReflectionProvider()); + return new ApiInterfaceExtendsRule(new ApiRuleHelper(), self::createReflectionProvider()); } public function testRuleInPhpStan(): void diff --git a/tests/PHPStan/Rules/Api/ApiRuleHelperTest.php b/tests/PHPStan/Rules/Api/ApiRuleHelperTest.php index 93d8428b77..6e43a9047e 100644 --- a/tests/PHPStan/Rules/Api/ApiRuleHelperTest.php +++ b/tests/PHPStan/Rules/Api/ApiRuleHelperTest.php @@ -8,7 +8,7 @@ class ApiRuleHelperTest extends TestCase { - public function dataIsPhpStanCode(): array + public static function dataIsPhpStanCode(): array { return [ [ diff --git a/tests/PHPStan/Rules/Api/ApiStaticCallRuleTest.php b/tests/PHPStan/Rules/Api/ApiStaticCallRuleTest.php index 8331674e4b..26da521670 100644 --- a/tests/PHPStan/Rules/Api/ApiStaticCallRuleTest.php +++ b/tests/PHPStan/Rules/Api/ApiStaticCallRuleTest.php @@ -14,7 +14,7 @@ class ApiStaticCallRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ApiStaticCallRule(new ApiRuleHelper(), $this->createReflectionProvider()); + return new ApiStaticCallRule(new ApiRuleHelper(), self::createReflectionProvider()); } public function testRuleInPhpStan(): void diff --git a/tests/PHPStan/Rules/Api/ApiTraitUseRuleTest.php b/tests/PHPStan/Rules/Api/ApiTraitUseRuleTest.php index da2dbbeefe..d15bbf5aa1 100644 --- a/tests/PHPStan/Rules/Api/ApiTraitUseRuleTest.php +++ b/tests/PHPStan/Rules/Api/ApiTraitUseRuleTest.php @@ -14,7 +14,7 @@ class ApiTraitUseRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ApiTraitUseRule(new ApiRuleHelper(), $this->createReflectionProvider()); + return new ApiTraitUseRule(new ApiRuleHelper(), self::createReflectionProvider()); } public function testRuleInPhpStan(): void diff --git a/tests/PHPStan/Rules/Api/GetTemplateTypeRuleTest.php b/tests/PHPStan/Rules/Api/GetTemplateTypeRuleTest.php index c65e8a6fd4..fab3cc8528 100644 --- a/tests/PHPStan/Rules/Api/GetTemplateTypeRuleTest.php +++ b/tests/PHPStan/Rules/Api/GetTemplateTypeRuleTest.php @@ -13,7 +13,7 @@ class GetTemplateTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - return new GetTemplateTypeRule($this->createReflectionProvider()); + return new GetTemplateTypeRule(self::createReflectionProvider()); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Api/RuntimeReflectionFunctionRuleTest.php b/tests/PHPStan/Rules/Api/RuntimeReflectionFunctionRuleTest.php index f043e062fc..a1b0203897 100644 --- a/tests/PHPStan/Rules/Api/RuntimeReflectionFunctionRuleTest.php +++ b/tests/PHPStan/Rules/Api/RuntimeReflectionFunctionRuleTest.php @@ -13,7 +13,7 @@ class RuntimeReflectionFunctionRuleTest extends RuleTestCase protected function getRule(): Rule { - return new RuntimeReflectionFunctionRule($this->createReflectionProvider()); + return new RuntimeReflectionFunctionRule(self::createReflectionProvider()); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Api/RuntimeReflectionInstantiationRuleTest.php b/tests/PHPStan/Rules/Api/RuntimeReflectionInstantiationRuleTest.php index ff9861230f..0ec03856c5 100644 --- a/tests/PHPStan/Rules/Api/RuntimeReflectionInstantiationRuleTest.php +++ b/tests/PHPStan/Rules/Api/RuntimeReflectionInstantiationRuleTest.php @@ -14,7 +14,7 @@ class RuntimeReflectionInstantiationRuleTest extends RuleTestCase protected function getRule(): Rule { - return new RuntimeReflectionInstantiationRule($this->createReflectionProvider()); + return new RuntimeReflectionInstantiationRule(self::createReflectionProvider()); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Arrays/ArrayDestructuringRuleTest.php b/tests/PHPStan/Rules/Arrays/ArrayDestructuringRuleTest.php index 3027ce23b7..19de8cfb95 100644 --- a/tests/PHPStan/Rules/Arrays/ArrayDestructuringRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/ArrayDestructuringRuleTest.php @@ -15,7 +15,7 @@ class ArrayDestructuringRuleTest extends RuleTestCase protected function getRule(): Rule { - $ruleLevelHelper = new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true); + $ruleLevelHelper = new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true); return new ArrayDestructuringRule( $ruleLevelHelper, diff --git a/tests/PHPStan/Rules/Arrays/ArrayUnpackingRuleTest.php b/tests/PHPStan/Rules/Arrays/ArrayUnpackingRuleTest.php index 0991d178cc..54f7d19336 100644 --- a/tests/PHPStan/Rules/Arrays/ArrayUnpackingRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/ArrayUnpackingRuleTest.php @@ -22,7 +22,7 @@ protected function getRule(): Rule { return new ArrayUnpackingRule( self::getContainer()->getByType(PhpVersion::class), - new RuleLevelHelper($this->createReflectionProvider(), true, false, $this->checkUnions, false, false, $this->checkBenevolentUnions, true), + new RuleLevelHelper(self::createReflectionProvider(), true, false, $this->checkUnions, false, false, $this->checkBenevolentUnions, true), ); } @@ -116,7 +116,7 @@ public function testRuleDoNotCheckUnions(): void ]); } - public function dataRuleOnPHP81(): array + public static function dataRuleOnPHP81(): array { return [ [true], diff --git a/tests/PHPStan/Rules/Arrays/InvalidKeyInArrayDimFetchRuleTest.php b/tests/PHPStan/Rules/Arrays/InvalidKeyInArrayDimFetchRuleTest.php index 757b25cbd7..48cfbdbef0 100644 --- a/tests/PHPStan/Rules/Arrays/InvalidKeyInArrayDimFetchRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/InvalidKeyInArrayDimFetchRuleTest.php @@ -15,7 +15,7 @@ class InvalidKeyInArrayDimFetchRuleTest extends RuleTestCase protected function getRule(): Rule { - $ruleLevelHelper = new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true); + $ruleLevelHelper = new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true); return new InvalidKeyInArrayDimFetchRule($ruleLevelHelper, true); } diff --git a/tests/PHPStan/Rules/Arrays/IterableInForeachRuleTest.php b/tests/PHPStan/Rules/Arrays/IterableInForeachRuleTest.php index c907f46ddd..e3f89bc1d6 100644 --- a/tests/PHPStan/Rules/Arrays/IterableInForeachRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/IterableInForeachRuleTest.php @@ -21,7 +21,7 @@ class IterableInForeachRuleTest extends RuleTestCase protected function getRule(): Rule { - return new IterableInForeachRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true)); + return new IterableInForeachRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true)); } public function testCheckWithMaybes(): void @@ -84,7 +84,7 @@ public function testBug4335(): void $this->analyse([__DIR__ . '/data/bug-4335.php'], []); } - public function dataMixed(): array + public static function dataMixed(): array { $explicitOnlyErrors = [ [ diff --git a/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php b/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php index 66374feb50..18f8417247 100644 --- a/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php @@ -23,7 +23,7 @@ class NonexistentOffsetInArrayDimFetchRuleTest extends RuleTestCase protected function getRule(): Rule { - $ruleLevelHelper = new RuleLevelHelper($this->createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true); + $ruleLevelHelper = new RuleLevelHelper(self::createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true); return new NonexistentOffsetInArrayDimFetchRule( $ruleLevelHelper, @@ -670,7 +670,7 @@ public function testNonExistentParentOffsetAccessLegal(): void ]); } - public function dataReportPossiblyNonexistentArrayOffset(): iterable + public static function dataReportPossiblyNonexistentArrayOffset(): iterable { yield [false, false, []]; yield [false, true, [ diff --git a/tests/PHPStan/Rules/Arrays/OffsetAccessAssignOpRuleTest.php b/tests/PHPStan/Rules/Arrays/OffsetAccessAssignOpRuleTest.php index e131c311a4..a2bfa6c29e 100644 --- a/tests/PHPStan/Rules/Arrays/OffsetAccessAssignOpRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/OffsetAccessAssignOpRuleTest.php @@ -17,7 +17,7 @@ class OffsetAccessAssignOpRuleTest extends RuleTestCase protected function getRule(): Rule { - $ruleLevelHelper = new RuleLevelHelper($this->createReflectionProvider(), true, false, $this->checkUnions, false, false, false, true); + $ruleLevelHelper = new RuleLevelHelper(self::createReflectionProvider(), true, false, $this->checkUnions, false, false, false, true); return new OffsetAccessAssignOpRule($ruleLevelHelper); } diff --git a/tests/PHPStan/Rules/Arrays/OffsetAccessAssignmentRuleTest.php b/tests/PHPStan/Rules/Arrays/OffsetAccessAssignmentRuleTest.php index 533dd185ae..542d2d00c5 100644 --- a/tests/PHPStan/Rules/Arrays/OffsetAccessAssignmentRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/OffsetAccessAssignmentRuleTest.php @@ -17,7 +17,7 @@ class OffsetAccessAssignmentRuleTest extends RuleTestCase protected function getRule(): Rule { - $ruleLevelHelper = new RuleLevelHelper($this->createReflectionProvider(), true, false, $this->checkUnionTypes, false, false, false, true); + $ruleLevelHelper = new RuleLevelHelper(self::createReflectionProvider(), true, false, $this->checkUnionTypes, false, false, false, true); return new OffsetAccessAssignmentRule($ruleLevelHelper); } diff --git a/tests/PHPStan/Rules/Arrays/OffsetAccessValueAssignmentRuleTest.php b/tests/PHPStan/Rules/Arrays/OffsetAccessValueAssignmentRuleTest.php index ff9ae587d7..c95ffe9668 100644 --- a/tests/PHPStan/Rules/Arrays/OffsetAccessValueAssignmentRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/OffsetAccessValueAssignmentRuleTest.php @@ -15,7 +15,7 @@ class OffsetAccessValueAssignmentRuleTest extends RuleTestCase protected function getRule(): Rule { - return new OffsetAccessValueAssignmentRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true)); + return new OffsetAccessValueAssignmentRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true)); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Arrays/UnpackIterableInArrayRuleTest.php b/tests/PHPStan/Rules/Arrays/UnpackIterableInArrayRuleTest.php index 15abfb7cef..f737cf7567 100644 --- a/tests/PHPStan/Rules/Arrays/UnpackIterableInArrayRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/UnpackIterableInArrayRuleTest.php @@ -21,7 +21,7 @@ class UnpackIterableInArrayRuleTest extends RuleTestCase protected function getRule(): Rule { - return new UnpackIterableInArrayRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true)); + return new UnpackIterableInArrayRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true)); } public function testRule(): void @@ -56,7 +56,7 @@ public function testRuleWithNullsafeVariant(): void ]); } - public function dataMixed(): array + public static function dataMixed(): array { $explicitOnlyErrors = [ [ diff --git a/tests/PHPStan/Rules/Cast/EchoRuleTest.php b/tests/PHPStan/Rules/Cast/EchoRuleTest.php index f08a205a79..52f97eff32 100644 --- a/tests/PHPStan/Rules/Cast/EchoRuleTest.php +++ b/tests/PHPStan/Rules/Cast/EchoRuleTest.php @@ -16,7 +16,7 @@ class EchoRuleTest extends RuleTestCase protected function getRule(): Rule { return new EchoRule( - new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true), + new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true), ); } diff --git a/tests/PHPStan/Rules/Cast/InvalidCastRuleTest.php b/tests/PHPStan/Rules/Cast/InvalidCastRuleTest.php index e5d5f11c2a..032945b37d 100644 --- a/tests/PHPStan/Rules/Cast/InvalidCastRuleTest.php +++ b/tests/PHPStan/Rules/Cast/InvalidCastRuleTest.php @@ -21,7 +21,7 @@ class InvalidCastRuleTest extends RuleTestCase protected function getRule(): Rule { - $broker = $this->createReflectionProvider(); + $broker = self::createReflectionProvider(); return new InvalidCastRule($broker, new RuleLevelHelper($broker, true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true)); } @@ -88,7 +88,7 @@ public function testCastObjectToString(): void ]); } - public function dataMixed(): array + public static function dataMixed(): array { $explicitOnlyErrors = [ [ diff --git a/tests/PHPStan/Rules/Cast/InvalidPartOfEncapsedStringRuleTest.php b/tests/PHPStan/Rules/Cast/InvalidPartOfEncapsedStringRuleTest.php index 642b296e4f..6df6e84e92 100644 --- a/tests/PHPStan/Rules/Cast/InvalidPartOfEncapsedStringRuleTest.php +++ b/tests/PHPStan/Rules/Cast/InvalidPartOfEncapsedStringRuleTest.php @@ -19,7 +19,7 @@ protected function getRule(): Rule { return new InvalidPartOfEncapsedStringRule( new ExprPrinter(new Printer()), - new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true), + new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true), ); } diff --git a/tests/PHPStan/Rules/Cast/PrintRuleTest.php b/tests/PHPStan/Rules/Cast/PrintRuleTest.php index fb0e7991fd..e4d1f4811a 100644 --- a/tests/PHPStan/Rules/Cast/PrintRuleTest.php +++ b/tests/PHPStan/Rules/Cast/PrintRuleTest.php @@ -16,7 +16,7 @@ class PrintRuleTest extends RuleTestCase protected function getRule(): Rule { return new PrintRule( - new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true), + new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true), ); } diff --git a/tests/PHPStan/Rules/Cast/UnsetCastRuleTest.php b/tests/PHPStan/Rules/Cast/UnsetCastRuleTest.php index ebab5c0aa6..5794d64380 100644 --- a/tests/PHPStan/Rules/Cast/UnsetCastRuleTest.php +++ b/tests/PHPStan/Rules/Cast/UnsetCastRuleTest.php @@ -19,7 +19,7 @@ protected function getRule(): Rule return new UnsetCastRule(new PhpVersion($this->phpVersion)); } - public function dataRule(): array + public static function dataRule(): array { return [ [ diff --git a/tests/PHPStan/Rules/Classes/ClassAttributesRuleTest.php b/tests/PHPStan/Rules/Classes/ClassAttributesRuleTest.php index 09ab4668c8..8c3a2c9911 100644 --- a/tests/PHPStan/Rules/Classes/ClassAttributesRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ClassAttributesRuleTest.php @@ -27,7 +27,7 @@ class ClassAttributesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ClassAttributesRule( new AttributesCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Classes/ClassConstantAttributesRuleTest.php b/tests/PHPStan/Rules/Classes/ClassConstantAttributesRuleTest.php index 93190d705a..a2a1f5328b 100644 --- a/tests/PHPStan/Rules/Classes/ClassConstantAttributesRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ClassConstantAttributesRuleTest.php @@ -22,7 +22,7 @@ class ClassConstantAttributesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ClassConstantAttributesRule( new AttributesCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Classes/ClassConstantRuleTest.php b/tests/PHPStan/Rules/Classes/ClassConstantRuleTest.php index 7fda6784cf..706c635dc8 100644 --- a/tests/PHPStan/Rules/Classes/ClassConstantRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ClassConstantRuleTest.php @@ -21,7 +21,7 @@ class ClassConstantRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ClassConstantRule( $reflectionProvider, new RuleLevelHelper($reflectionProvider, true, false, true, false, false, false, true), @@ -189,7 +189,7 @@ public function testClassExists(): void ]); } - public function dataClassConstantOnExpression(): array + public static function dataClassConstantOnExpression(): array { return [ [ diff --git a/tests/PHPStan/Rules/Classes/ExistingClassInClassExtendsRuleTest.php b/tests/PHPStan/Rules/Classes/ExistingClassInClassExtendsRuleTest.php index 83d23411de..18ed77fe2a 100644 --- a/tests/PHPStan/Rules/Classes/ExistingClassInClassExtendsRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ExistingClassInClassExtendsRuleTest.php @@ -17,7 +17,7 @@ class ExistingClassInClassExtendsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassInClassExtendsRule( new ClassNameCheck( new ClassCaseSensitivityCheck($reflectionProvider, true), diff --git a/tests/PHPStan/Rules/Classes/ExistingClassInInstanceOfRuleTest.php b/tests/PHPStan/Rules/Classes/ExistingClassInInstanceOfRuleTest.php index 26cf177300..e173d63ea6 100644 --- a/tests/PHPStan/Rules/Classes/ExistingClassInInstanceOfRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ExistingClassInInstanceOfRuleTest.php @@ -19,7 +19,7 @@ class ExistingClassInInstanceOfRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassInInstanceOfRule( $reflectionProvider, new ClassNameCheck( diff --git a/tests/PHPStan/Rules/Classes/ExistingClassInTraitUseRuleTest.php b/tests/PHPStan/Rules/Classes/ExistingClassInTraitUseRuleTest.php index f6e5ac6b5e..99ec0cab8d 100644 --- a/tests/PHPStan/Rules/Classes/ExistingClassInTraitUseRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ExistingClassInTraitUseRuleTest.php @@ -17,7 +17,7 @@ class ExistingClassInTraitUseRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassInTraitUseRule( new ClassNameCheck( new ClassCaseSensitivityCheck($reflectionProvider, true), diff --git a/tests/PHPStan/Rules/Classes/ExistingClassesInClassImplementsRuleTest.php b/tests/PHPStan/Rules/Classes/ExistingClassesInClassImplementsRuleTest.php index d51a34a621..ab88558cae 100644 --- a/tests/PHPStan/Rules/Classes/ExistingClassesInClassImplementsRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ExistingClassesInClassImplementsRuleTest.php @@ -17,7 +17,7 @@ class ExistingClassesInClassImplementsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassesInClassImplementsRule( new ClassNameCheck( new ClassCaseSensitivityCheck($reflectionProvider, true), diff --git a/tests/PHPStan/Rules/Classes/ExistingClassesInEnumImplementsRuleTest.php b/tests/PHPStan/Rules/Classes/ExistingClassesInEnumImplementsRuleTest.php index 7ed5797895..1164d86b77 100644 --- a/tests/PHPStan/Rules/Classes/ExistingClassesInEnumImplementsRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ExistingClassesInEnumImplementsRuleTest.php @@ -17,7 +17,7 @@ class ExistingClassesInEnumImplementsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassesInEnumImplementsRule( new ClassNameCheck( diff --git a/tests/PHPStan/Rules/Classes/ExistingClassesInInterfaceExtendsRuleTest.php b/tests/PHPStan/Rules/Classes/ExistingClassesInInterfaceExtendsRuleTest.php index c6a3db9ad4..e372d75d1e 100644 --- a/tests/PHPStan/Rules/Classes/ExistingClassesInInterfaceExtendsRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ExistingClassesInInterfaceExtendsRuleTest.php @@ -17,7 +17,7 @@ class ExistingClassesInInterfaceExtendsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassesInInterfaceExtendsRule( new ClassNameCheck( new ClassCaseSensitivityCheck($reflectionProvider, true), diff --git a/tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php b/tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php index 94e1ff695d..f9cdd6ff9b 100644 --- a/tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php @@ -22,7 +22,7 @@ class ForbiddenNameCheckExtensionRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new InstantiationRule( self::getContainer(), $reflectionProvider, diff --git a/tests/PHPStan/Rules/Classes/ImpossibleInstanceOfRuleTest.php b/tests/PHPStan/Rules/Classes/ImpossibleInstanceOfRuleTest.php index 2ef0c3d184..c66cf737b7 100644 --- a/tests/PHPStan/Rules/Classes/ImpossibleInstanceOfRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ImpossibleInstanceOfRuleTest.php @@ -439,7 +439,7 @@ public function testBug4689(): void $this->analyse([__DIR__ . '/data/bug-4689.php'], []); } - public function dataReportAlwaysTrueInLastCondition(): iterable + public static function dataReportAlwaysTrueInLastCondition(): iterable { yield [false, [ [ diff --git a/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php b/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php index 0c361880e7..efacea58d5 100644 --- a/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php +++ b/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php @@ -22,7 +22,7 @@ class InstantiationRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new InstantiationRule( self::getContainer(), $reflectionProvider, diff --git a/tests/PHPStan/Rules/Classes/LocalTypeAliasesRuleTest.php b/tests/PHPStan/Rules/Classes/LocalTypeAliasesRuleTest.php index 12631f5c74..1105fcf3d4 100644 --- a/tests/PHPStan/Rules/Classes/LocalTypeAliasesRuleTest.php +++ b/tests/PHPStan/Rules/Classes/LocalTypeAliasesRuleTest.php @@ -21,12 +21,12 @@ class LocalTypeAliasesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new LocalTypeAliasesRule( new LocalTypeAliasesCheck( ['GlobalTypeAlias' => 'int|string'], - $this->createReflectionProvider(), + self::createReflectionProvider(), self::getContainer()->getByType(TypeNodeResolver::class), new MissingTypehintCheck(true, []), new ClassNameCheck( diff --git a/tests/PHPStan/Rules/Classes/LocalTypeTraitAliasesRuleTest.php b/tests/PHPStan/Rules/Classes/LocalTypeTraitAliasesRuleTest.php index 4662acc732..bd93fd00a2 100644 --- a/tests/PHPStan/Rules/Classes/LocalTypeTraitAliasesRuleTest.php +++ b/tests/PHPStan/Rules/Classes/LocalTypeTraitAliasesRuleTest.php @@ -20,12 +20,12 @@ class LocalTypeTraitAliasesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new LocalTypeTraitAliasesRule( new LocalTypeAliasesCheck( ['GlobalTypeAlias' => 'int|string'], - $this->createReflectionProvider(), + self::createReflectionProvider(), self::getContainer()->getByType(TypeNodeResolver::class), new MissingTypehintCheck(true, []), new ClassNameCheck( @@ -40,7 +40,7 @@ protected function getRule(): Rule true, true, ), - $this->createReflectionProvider(), + self::createReflectionProvider(), ); } diff --git a/tests/PHPStan/Rules/Classes/LocalTypeTraitUseAliasesRuleTest.php b/tests/PHPStan/Rules/Classes/LocalTypeTraitUseAliasesRuleTest.php index 0748cdb4b6..d2c40ea875 100644 --- a/tests/PHPStan/Rules/Classes/LocalTypeTraitUseAliasesRuleTest.php +++ b/tests/PHPStan/Rules/Classes/LocalTypeTraitUseAliasesRuleTest.php @@ -20,12 +20,12 @@ class LocalTypeTraitUseAliasesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new LocalTypeTraitUseAliasesRule( new LocalTypeAliasesCheck( ['GlobalTypeAlias' => 'int|string'], - $this->createReflectionProvider(), + self::createReflectionProvider(), self::getContainer()->getByType(TypeNodeResolver::class), new MissingTypehintCheck(true, []), new ClassNameCheck( diff --git a/tests/PHPStan/Rules/Classes/MethodTagRuleTest.php b/tests/PHPStan/Rules/Classes/MethodTagRuleTest.php index 93e05c3675..3587a486ac 100644 --- a/tests/PHPStan/Rules/Classes/MethodTagRuleTest.php +++ b/tests/PHPStan/Rules/Classes/MethodTagRuleTest.php @@ -19,7 +19,7 @@ class MethodTagRuleTest extends RuleTestCase protected function getRule(): TRule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new MethodTagRule( new MethodTagCheck( diff --git a/tests/PHPStan/Rules/Classes/MethodTagTraitRuleTest.php b/tests/PHPStan/Rules/Classes/MethodTagTraitRuleTest.php index 1ec2063551..2581708333 100644 --- a/tests/PHPStan/Rules/Classes/MethodTagTraitRuleTest.php +++ b/tests/PHPStan/Rules/Classes/MethodTagTraitRuleTest.php @@ -19,7 +19,7 @@ class MethodTagTraitRuleTest extends RuleTestCase protected function getRule(): TRule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new MethodTagTraitRule( new MethodTagCheck( diff --git a/tests/PHPStan/Rules/Classes/MethodTagTraitUseRuleTest.php b/tests/PHPStan/Rules/Classes/MethodTagTraitUseRuleTest.php index 1696a2515d..241f56e472 100644 --- a/tests/PHPStan/Rules/Classes/MethodTagTraitUseRuleTest.php +++ b/tests/PHPStan/Rules/Classes/MethodTagTraitUseRuleTest.php @@ -20,7 +20,7 @@ class MethodTagTraitUseRuleTest extends RuleTestCase protected function getRule(): TRule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new MethodTagTraitUseRule( new MethodTagCheck( diff --git a/tests/PHPStan/Rules/Classes/MixinRuleTest.php b/tests/PHPStan/Rules/Classes/MixinRuleTest.php index d7c804c237..8a0e3a3e6a 100644 --- a/tests/PHPStan/Rules/Classes/MixinRuleTest.php +++ b/tests/PHPStan/Rules/Classes/MixinRuleTest.php @@ -20,7 +20,7 @@ class MixinRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new MixinRule( new MixinCheck( diff --git a/tests/PHPStan/Rules/Classes/MixinTraitRuleTest.php b/tests/PHPStan/Rules/Classes/MixinTraitRuleTest.php index 7ae81a0f18..0c330061d8 100644 --- a/tests/PHPStan/Rules/Classes/MixinTraitRuleTest.php +++ b/tests/PHPStan/Rules/Classes/MixinTraitRuleTest.php @@ -19,7 +19,7 @@ class MixinTraitRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new MixinTraitRule( new MixinCheck( diff --git a/tests/PHPStan/Rules/Classes/MixinTraitUseRuleTest.php b/tests/PHPStan/Rules/Classes/MixinTraitUseRuleTest.php index d11675e208..23108e7e09 100644 --- a/tests/PHPStan/Rules/Classes/MixinTraitUseRuleTest.php +++ b/tests/PHPStan/Rules/Classes/MixinTraitUseRuleTest.php @@ -19,7 +19,7 @@ class MixinTraitUseRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new MixinTraitUseRule( new MixinCheck( diff --git a/tests/PHPStan/Rules/Classes/PropertyTagRuleTest.php b/tests/PHPStan/Rules/Classes/PropertyTagRuleTest.php index 04f0ecd7f3..c78a1ab297 100644 --- a/tests/PHPStan/Rules/Classes/PropertyTagRuleTest.php +++ b/tests/PHPStan/Rules/Classes/PropertyTagRuleTest.php @@ -19,7 +19,7 @@ class PropertyTagRuleTest extends RuleTestCase protected function getRule(): TRule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new PropertyTagRule( new PropertyTagCheck( diff --git a/tests/PHPStan/Rules/Classes/PropertyTagTraitRuleTest.php b/tests/PHPStan/Rules/Classes/PropertyTagTraitRuleTest.php index def6012d0d..df9bfe5254 100644 --- a/tests/PHPStan/Rules/Classes/PropertyTagTraitRuleTest.php +++ b/tests/PHPStan/Rules/Classes/PropertyTagTraitRuleTest.php @@ -19,7 +19,7 @@ class PropertyTagTraitRuleTest extends RuleTestCase protected function getRule(): TRule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new PropertyTagTraitRule( new PropertyTagCheck( diff --git a/tests/PHPStan/Rules/Classes/PropertyTagTraitUseRuleTest.php b/tests/PHPStan/Rules/Classes/PropertyTagTraitUseRuleTest.php index 9231ebd4e4..cdce3b7f87 100644 --- a/tests/PHPStan/Rules/Classes/PropertyTagTraitUseRuleTest.php +++ b/tests/PHPStan/Rules/Classes/PropertyTagTraitUseRuleTest.php @@ -19,7 +19,7 @@ class PropertyTagTraitUseRuleTest extends RuleTestCase protected function getRule(): TRule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new PropertyTagTraitUseRule( new PropertyTagCheck( diff --git a/tests/PHPStan/Rules/Classes/UnusedConstructorParametersRuleTest.php b/tests/PHPStan/Rules/Classes/UnusedConstructorParametersRuleTest.php index 542ba55e5e..3550be5799 100644 --- a/tests/PHPStan/Rules/Classes/UnusedConstructorParametersRuleTest.php +++ b/tests/PHPStan/Rules/Classes/UnusedConstructorParametersRuleTest.php @@ -17,7 +17,7 @@ class UnusedConstructorParametersRuleTest extends RuleTestCase protected function getRule(): Rule { return new UnusedConstructorParametersRule(new UnusedFunctionParametersCheck( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->reportExactLine, )); } diff --git a/tests/PHPStan/Rules/Comparison/BooleanAndConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/BooleanAndConstantConditionRuleTest.php index 3115a897b7..844d392d49 100644 --- a/tests/PHPStan/Rules/Comparison/BooleanAndConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/BooleanAndConstantConditionRuleTest.php @@ -20,7 +20,7 @@ protected function getRule(): Rule return new BooleanAndConstantConditionRule( new ConstantConditionRuleHelper( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, @@ -260,7 +260,7 @@ public function testReportPhpDoc(): void ]); } - public function dataTreatPhpDocTypesAsCertainRegression(): array + public static function dataTreatPhpDocTypesAsCertainRegression(): array { return [ [ @@ -344,7 +344,7 @@ public function testBug5743(): void $this->analyse([__DIR__ . '/data/bug-5743.php'], []); } - public function dataBug4969(): iterable + public static function dataBug4969(): iterable { yield [false, []]; yield [true, [ @@ -366,7 +366,7 @@ public function testBug4969(bool $treatPhpDocTypesAsCertain, array $expectedErro $this->analyse([__DIR__ . '/data/bug-4969.php'], $expectedErrors); } - public function dataReportAlwaysTrueInLastCondition(): iterable + public static function dataReportAlwaysTrueInLastCondition(): iterable { yield [false, [ [ diff --git a/tests/PHPStan/Rules/Comparison/BooleanNotConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/BooleanNotConstantConditionRuleTest.php index f9bef9b5d1..58283f718d 100644 --- a/tests/PHPStan/Rules/Comparison/BooleanNotConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/BooleanNotConstantConditionRuleTest.php @@ -20,7 +20,7 @@ protected function getRule(): Rule return new BooleanNotConstantConditionRule( new ConstantConditionRuleHelper( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, @@ -101,7 +101,7 @@ public function testReportPhpDoc(): void ]); } - public function dataTreatPhpDocTypesAsCertainRegression(): array + public static function dataTreatPhpDocTypesAsCertainRegression(): array { return [ [ @@ -152,7 +152,7 @@ public function testBug7937(): void $this->analyse([__DIR__ . '/data/bug-7937.php'], []); } - public function dataReportAlwaysTrueInLastCondition(): iterable + public static function dataReportAlwaysTrueInLastCondition(): iterable { yield [false, [ [ diff --git a/tests/PHPStan/Rules/Comparison/BooleanOrConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/BooleanOrConstantConditionRuleTest.php index ca46233349..d648ef93c9 100644 --- a/tests/PHPStan/Rules/Comparison/BooleanOrConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/BooleanOrConstantConditionRuleTest.php @@ -21,7 +21,7 @@ protected function getRule(): Rule return new BooleanOrConstantConditionRule( new ConstantConditionRuleHelper( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, @@ -243,7 +243,7 @@ public function testReportPhpDoc(): void ]); } - public function dataTreatPhpDocTypesAsCertainRegression(): array + public static function dataTreatPhpDocTypesAsCertainRegression(): array { return [ [ @@ -292,7 +292,7 @@ public function testBug7881(): void $this->analyse([__DIR__ . '/data/bug-7881.php'], []); } - public function dataReportAlwaysTrueInLastCondition(): iterable + public static function dataReportAlwaysTrueInLastCondition(): iterable { yield [false, [ [ diff --git a/tests/PHPStan/Rules/Comparison/ConstantLooseComparisonRuleTest.php b/tests/PHPStan/Rules/Comparison/ConstantLooseComparisonRuleTest.php index f981f92621..7e772a6153 100644 --- a/tests/PHPStan/Rules/Comparison/ConstantLooseComparisonRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/ConstantLooseComparisonRuleTest.php @@ -88,7 +88,7 @@ public function testBug8485(): void ]); } - public function dataReportAlwaysTrueInLastCondition(): iterable + public static function dataReportAlwaysTrueInLastCondition(): iterable { yield [false, [ [ @@ -119,7 +119,7 @@ public function testReportAlwaysTrueInLastCondition(bool $reportAlwaysTrueInLast $this->analyse([__DIR__ . '/data/loose-comparison-report-always-true-last-condition.php'], $expectedErrors); } - public function dataTreatPhpDocTypesAsCertain(): iterable + public static function dataTreatPhpDocTypesAsCertain(): iterable { yield [false, []]; yield [true, [ diff --git a/tests/PHPStan/Rules/Comparison/DoWhileLoopConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/DoWhileLoopConstantConditionRuleTest.php index 38f3237a45..cbfdf67cad 100644 --- a/tests/PHPStan/Rules/Comparison/DoWhileLoopConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/DoWhileLoopConstantConditionRuleTest.php @@ -18,7 +18,7 @@ protected function getRule(): Rule return new DoWhileLoopConstantConditionRule( new ConstantConditionRuleHelper( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, diff --git a/tests/PHPStan/Rules/Comparison/ElseIfConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/ElseIfConstantConditionRuleTest.php index f337950a0f..1cdcd02893 100644 --- a/tests/PHPStan/Rules/Comparison/ElseIfConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/ElseIfConstantConditionRuleTest.php @@ -21,7 +21,7 @@ protected function getRule(): Rule return new ElseIfConstantConditionRule( new ConstantConditionRuleHelper( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, @@ -39,7 +39,7 @@ protected function shouldTreatPhpDocTypesAsCertain(): bool return $this->treatPhpDocTypesAsCertain; } - public function dataRule(): iterable + public static function dataRule(): iterable { yield [false, [ [ diff --git a/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php index 25e362f6cc..4daa97d5dc 100644 --- a/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/IfConstantConditionRuleTest.php @@ -19,7 +19,7 @@ protected function getRule(): Rule return new IfConstantConditionRule( new ConstantConditionRuleHelper( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, diff --git a/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeFunctionCallRuleTest.php b/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeFunctionCallRuleTest.php index 219e0450c1..9ad101b290 100644 --- a/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeFunctionCallRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeFunctionCallRuleTest.php @@ -25,7 +25,7 @@ protected function getRule(): Rule { return new ImpossibleCheckTypeFunctionCallRule( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [stdClass::class], $this->treatPhpDocTypesAsCertain, @@ -674,7 +674,7 @@ public function testImpossibleMethodExistOnGenericClassString(): void ]); } - public function dataReportAlwaysTrueInLastCondition(): iterable + public static function dataReportAlwaysTrueInLastCondition(): iterable { yield [false, [ [ diff --git a/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeGenericOverwriteRuleTest.php b/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeGenericOverwriteRuleTest.php index 67245ebaba..aff6f8d5df 100644 --- a/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeGenericOverwriteRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeGenericOverwriteRuleTest.php @@ -15,7 +15,7 @@ public function getRule(): Rule { return new ImpossibleCheckTypeMethodCallRule( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], true, diff --git a/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeMethodCallRuleEqualsTest.php b/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeMethodCallRuleEqualsTest.php index b81646c023..2eec07890a 100644 --- a/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeMethodCallRuleEqualsTest.php +++ b/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeMethodCallRuleEqualsTest.php @@ -15,7 +15,7 @@ public function getRule(): Rule { return new ImpossibleCheckTypeMethodCallRule( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], true, diff --git a/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeMethodCallRuleTest.php b/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeMethodCallRuleTest.php index 6bc2d8e2d5..843e7fee11 100644 --- a/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeMethodCallRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeMethodCallRuleTest.php @@ -20,7 +20,7 @@ public function getRule(): Rule { return new ImpossibleCheckTypeMethodCallRule( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, @@ -222,7 +222,7 @@ public function testBug8169(): void ]); } - public function dataReportAlwaysTrueInLastCondition(): iterable + public static function dataReportAlwaysTrueInLastCondition(): iterable { yield [false, [ [ diff --git a/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRuleTest.php b/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRuleTest.php index 1cdbc1a7ad..685ce36b67 100644 --- a/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRuleTest.php @@ -19,7 +19,7 @@ public function getRule(): Rule { return new ImpossibleCheckTypeStaticMethodCallRule( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, @@ -112,7 +112,7 @@ public function testAssertUnresolvedGeneric(): void $this->analyse([__DIR__ . '/data/assert-unresolved-generic.php'], []); } - public function dataReportAlwaysTrueInLastCondition(): iterable + public static function dataReportAlwaysTrueInLastCondition(): iterable { yield [false, [ [ diff --git a/tests/PHPStan/Rules/Comparison/LogicalXorConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/LogicalXorConstantConditionRuleTest.php index c191856047..f3ed1ef002 100644 --- a/tests/PHPStan/Rules/Comparison/LogicalXorConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/LogicalXorConstantConditionRuleTest.php @@ -20,7 +20,7 @@ protected function getRule(): TRule return new LogicalXorConstantConditionRule( new ConstantConditionRuleHelper( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, diff --git a/tests/PHPStan/Rules/Comparison/MatchExpressionRuleTest.php b/tests/PHPStan/Rules/Comparison/MatchExpressionRuleTest.php index d7a005c589..b5cb2d4407 100644 --- a/tests/PHPStan/Rules/Comparison/MatchExpressionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/MatchExpressionRuleTest.php @@ -21,7 +21,7 @@ protected function getRule(): Rule return new MatchExpressionRule( new ConstantConditionRuleHelper( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, @@ -309,7 +309,7 @@ public function testLastArmAlwaysTrue(): void ]); } - public function dataReportAlwaysTrueInLastCondition(): iterable + public static function dataReportAlwaysTrueInLastCondition(): iterable { yield [false, [ [ diff --git a/tests/PHPStan/Rules/Comparison/NumberComparisonOperatorsConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/NumberComparisonOperatorsConstantConditionRuleTest.php index eb7fe43290..244aa3c660 100644 --- a/tests/PHPStan/Rules/Comparison/NumberComparisonOperatorsConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/NumberComparisonOperatorsConstantConditionRuleTest.php @@ -165,7 +165,7 @@ public function testBug8643(): void $this->analyse([__DIR__ . '/data/bug-8643.php'], []); } - public function dataTreatPhpDocTypesAsCertain(): iterable + public static function dataTreatPhpDocTypesAsCertain(): iterable { yield [ false, diff --git a/tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php b/tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php index 4c27bfd80f..e694b94796 100644 --- a/tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php @@ -658,7 +658,7 @@ public function testBug8736(): void $this->analyse([__DIR__ . '/data/bug-8736.php'], []); } - public function dataLastMatchArm(): iterable + public static function dataLastMatchArm(): iterable { yield [false, [ [ diff --git a/tests/PHPStan/Rules/Comparison/TernaryOperatorConstantConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/TernaryOperatorConstantConditionRuleTest.php index e1e7474e17..250f639068 100644 --- a/tests/PHPStan/Rules/Comparison/TernaryOperatorConstantConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/TernaryOperatorConstantConditionRuleTest.php @@ -18,7 +18,7 @@ protected function getRule(): Rule return new TernaryOperatorConstantConditionRule( new ConstantConditionRuleHelper( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, diff --git a/tests/PHPStan/Rules/Comparison/WhileLoopAlwaysFalseConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/WhileLoopAlwaysFalseConditionRuleTest.php index 4d65f02d2b..a41bc8158f 100644 --- a/tests/PHPStan/Rules/Comparison/WhileLoopAlwaysFalseConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/WhileLoopAlwaysFalseConditionRuleTest.php @@ -18,7 +18,7 @@ protected function getRule(): Rule return new WhileLoopAlwaysFalseConditionRule( new ConstantConditionRuleHelper( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, diff --git a/tests/PHPStan/Rules/Comparison/WhileLoopAlwaysTrueConditionRuleTest.php b/tests/PHPStan/Rules/Comparison/WhileLoopAlwaysTrueConditionRuleTest.php index 4a377f1855..7a1e99f5c1 100644 --- a/tests/PHPStan/Rules/Comparison/WhileLoopAlwaysTrueConditionRuleTest.php +++ b/tests/PHPStan/Rules/Comparison/WhileLoopAlwaysTrueConditionRuleTest.php @@ -18,7 +18,7 @@ protected function getRule(): Rule return new WhileLoopAlwaysTrueConditionRule( new ConstantConditionRuleHelper( new ImpossibleCheckTypeHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->getTypeSpecifier(), [], $this->treatPhpDocTypesAsCertain, diff --git a/tests/PHPStan/Rules/Constants/DynamicClassConstantFetchRuleTest.php b/tests/PHPStan/Rules/Constants/DynamicClassConstantFetchRuleTest.php index 4a0b85b34b..5d829849db 100644 --- a/tests/PHPStan/Rules/Constants/DynamicClassConstantFetchRuleTest.php +++ b/tests/PHPStan/Rules/Constants/DynamicClassConstantFetchRuleTest.php @@ -18,7 +18,7 @@ protected function getRule(): TRule { return new DynamicClassConstantFetchRule( self::getContainer()->getByType(PhpVersion::class), - new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true), + new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true), ); } diff --git a/tests/PHPStan/Rules/Constants/FinalConstantRuleTest.php b/tests/PHPStan/Rules/Constants/FinalConstantRuleTest.php index 1fac7d6798..0e2938f22c 100644 --- a/tests/PHPStan/Rules/Constants/FinalConstantRuleTest.php +++ b/tests/PHPStan/Rules/Constants/FinalConstantRuleTest.php @@ -19,7 +19,7 @@ protected function getRule(): Rule return new FinalConstantRule(new PhpVersion($this->phpVersionId)); } - public function dataRule(): array + public static function dataRule(): array { return [ [ diff --git a/tests/PHPStan/Rules/DeadCode/CallToConstructorStatementWithoutImpurePointsRuleTest.php b/tests/PHPStan/Rules/DeadCode/CallToConstructorStatementWithoutImpurePointsRuleTest.php index ac630c4880..c4dd2583f3 100644 --- a/tests/PHPStan/Rules/DeadCode/CallToConstructorStatementWithoutImpurePointsRuleTest.php +++ b/tests/PHPStan/Rules/DeadCode/CallToConstructorStatementWithoutImpurePointsRuleTest.php @@ -29,7 +29,7 @@ public function testRule(): void protected function getCollectors(): array { return [ - new PossiblyPureNewCollector($this->createReflectionProvider()), + new PossiblyPureNewCollector(self::createReflectionProvider()), new ConstructorWithoutImpurePointsCollector(), ]; } diff --git a/tests/PHPStan/Rules/DeadCode/CallToFunctionStatementWithoutImpurePointsRuleTest.php b/tests/PHPStan/Rules/DeadCode/CallToFunctionStatementWithoutImpurePointsRuleTest.php index 3c5fe7a2b9..6fc162edc6 100644 --- a/tests/PHPStan/Rules/DeadCode/CallToFunctionStatementWithoutImpurePointsRuleTest.php +++ b/tests/PHPStan/Rules/DeadCode/CallToFunctionStatementWithoutImpurePointsRuleTest.php @@ -29,7 +29,7 @@ public function testRule(): void protected function getCollectors(): array { return [ - new PossiblyPureFuncCallCollector($this->createReflectionProvider()), + new PossiblyPureFuncCallCollector(self::createReflectionProvider()), new FunctionWithoutImpurePointsCollector(), ]; } diff --git a/tests/PHPStan/Rules/DeadCode/UnreachableStatementRuleTest.php b/tests/PHPStan/Rules/DeadCode/UnreachableStatementRuleTest.php index ec97b0481a..d852f08d8d 100644 --- a/tests/PHPStan/Rules/DeadCode/UnreachableStatementRuleTest.php +++ b/tests/PHPStan/Rules/DeadCode/UnreachableStatementRuleTest.php @@ -69,7 +69,7 @@ public function testRuleTopLevel(): void ]); } - public function dataBugWithoutGitHubIssue1(): array + public static function dataBugWithoutGitHubIssue1(): array { return [ [ diff --git a/tests/PHPStan/Rules/Debug/DebugScopeRuleTest.php b/tests/PHPStan/Rules/Debug/DebugScopeRuleTest.php index ff5294eded..90a5dd508c 100644 --- a/tests/PHPStan/Rules/Debug/DebugScopeRuleTest.php +++ b/tests/PHPStan/Rules/Debug/DebugScopeRuleTest.php @@ -14,7 +14,7 @@ class DebugScopeRuleTest extends RuleTestCase protected function getRule(): Rule { - return new DebugScopeRule($this->createReflectionProvider()); + return new DebugScopeRule(self::createReflectionProvider()); } public function testRuleInPhpStanNamespace(): void diff --git a/tests/PHPStan/Rules/Debug/DumpPhpDocTypeRuleTest.php b/tests/PHPStan/Rules/Debug/DumpPhpDocTypeRuleTest.php index ed56b46bd7..8b137b1611 100644 --- a/tests/PHPStan/Rules/Debug/DumpPhpDocTypeRuleTest.php +++ b/tests/PHPStan/Rules/Debug/DumpPhpDocTypeRuleTest.php @@ -14,7 +14,7 @@ class DumpPhpDocTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - return new DumpPhpDocTypeRule($this->createReflectionProvider(), new Printer()); + return new DumpPhpDocTypeRule(self::createReflectionProvider(), new Printer()); } public function testRuleSymbols(): void diff --git a/tests/PHPStan/Rules/Debug/DumpTypeRuleTest.php b/tests/PHPStan/Rules/Debug/DumpTypeRuleTest.php index 7a2ff3aa6a..fb4c489dea 100644 --- a/tests/PHPStan/Rules/Debug/DumpTypeRuleTest.php +++ b/tests/PHPStan/Rules/Debug/DumpTypeRuleTest.php @@ -13,7 +13,7 @@ class DumpTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - return new DumpTypeRule($this->createReflectionProvider()); + return new DumpTypeRule(self::createReflectionProvider()); } public function testRuleInPhpStanNamespace(): void diff --git a/tests/PHPStan/Rules/Debug/FileAssertRuleTest.php b/tests/PHPStan/Rules/Debug/FileAssertRuleTest.php index aec3ed1500..40224fc3f2 100644 --- a/tests/PHPStan/Rules/Debug/FileAssertRuleTest.php +++ b/tests/PHPStan/Rules/Debug/FileAssertRuleTest.php @@ -13,7 +13,7 @@ class FileAssertRuleTest extends RuleTestCase protected function getRule(): Rule { - return new FileAssertRule($this->createReflectionProvider()); + return new FileAssertRule(self::createReflectionProvider()); } public function testRule(): void diff --git a/tests/PHPStan/Rules/EnumCases/EnumCaseAttributesRuleTest.php b/tests/PHPStan/Rules/EnumCases/EnumCaseAttributesRuleTest.php index 5de7d45b5d..f789f9c092 100644 --- a/tests/PHPStan/Rules/EnumCases/EnumCaseAttributesRuleTest.php +++ b/tests/PHPStan/Rules/EnumCases/EnumCaseAttributesRuleTest.php @@ -23,7 +23,7 @@ class EnumCaseAttributesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new EnumCaseAttributesRule( new AttributesCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Exceptions/AbilityToDisableImplicitThrowsTest.php b/tests/PHPStan/Rules/Exceptions/AbilityToDisableImplicitThrowsTest.php index 33a117fd17..c0db350002 100644 --- a/tests/PHPStan/Rules/Exceptions/AbilityToDisableImplicitThrowsTest.php +++ b/tests/PHPStan/Rules/Exceptions/AbilityToDisableImplicitThrowsTest.php @@ -16,7 +16,7 @@ class AbilityToDisableImplicitThrowsTest extends RuleTestCase protected function getRule(): Rule { return new CatchWithUnthrownExceptionRule(new DefaultExceptionTypeResolver( - $this->createReflectionProvider(), + self::createReflectionProvider(), [], [], [], diff --git a/tests/PHPStan/Rules/Exceptions/Bug5364Test.php b/tests/PHPStan/Rules/Exceptions/Bug5364Test.php index e6c4a38a42..9049c7ad16 100644 --- a/tests/PHPStan/Rules/Exceptions/Bug5364Test.php +++ b/tests/PHPStan/Rules/Exceptions/Bug5364Test.php @@ -15,7 +15,7 @@ protected function getRule(): Rule { return new MissingCheckedExceptionInMethodThrowsRule( new MissingCheckedExceptionInThrowsCheck(new DefaultExceptionTypeResolver( - $this->createReflectionProvider(), + self::createReflectionProvider(), [], [], [], diff --git a/tests/PHPStan/Rules/Exceptions/CatchWithUnthrownExceptionRuleStubsTest.php b/tests/PHPStan/Rules/Exceptions/CatchWithUnthrownExceptionRuleStubsTest.php index 6b32128600..421fdb719d 100644 --- a/tests/PHPStan/Rules/Exceptions/CatchWithUnthrownExceptionRuleStubsTest.php +++ b/tests/PHPStan/Rules/Exceptions/CatchWithUnthrownExceptionRuleStubsTest.php @@ -14,7 +14,7 @@ class CatchWithUnthrownExceptionRuleStubsTest extends RuleTestCase protected function getRule(): Rule { return new CatchWithUnthrownExceptionRule(new DefaultExceptionTypeResolver( - $this->createReflectionProvider(), + self::createReflectionProvider(), [], [], [], diff --git a/tests/PHPStan/Rules/Exceptions/CatchWithUnthrownExceptionRuleTest.php b/tests/PHPStan/Rules/Exceptions/CatchWithUnthrownExceptionRuleTest.php index f9b8b96d7c..f29b8cbc02 100644 --- a/tests/PHPStan/Rules/Exceptions/CatchWithUnthrownExceptionRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/CatchWithUnthrownExceptionRuleTest.php @@ -22,7 +22,7 @@ class CatchWithUnthrownExceptionRuleTest extends RuleTestCase protected function getRule(): Rule { return new CatchWithUnthrownExceptionRule(new DefaultExceptionTypeResolver( - $this->createReflectionProvider(), + self::createReflectionProvider(), [], $this->uncheckedExceptionClasses, [], diff --git a/tests/PHPStan/Rules/Exceptions/CaughtExceptionExistenceRuleTest.php b/tests/PHPStan/Rules/Exceptions/CaughtExceptionExistenceRuleTest.php index 1ec6854a48..c56c830bb6 100644 --- a/tests/PHPStan/Rules/Exceptions/CaughtExceptionExistenceRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/CaughtExceptionExistenceRuleTest.php @@ -16,7 +16,7 @@ class CaughtExceptionExistenceRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new CaughtExceptionExistenceRule( $reflectionProvider, new ClassNameCheck( diff --git a/tests/PHPStan/Rules/Exceptions/DefaultExceptionTypeResolverTest.php b/tests/PHPStan/Rules/Exceptions/DefaultExceptionTypeResolverTest.php index 0708028924..22f47f3615 100644 --- a/tests/PHPStan/Rules/Exceptions/DefaultExceptionTypeResolverTest.php +++ b/tests/PHPStan/Rules/Exceptions/DefaultExceptionTypeResolverTest.php @@ -12,7 +12,7 @@ class DefaultExceptionTypeResolverTest extends PHPStanTestCase { - public function dataIsCheckedException(): array + public static function dataIsCheckedException(): array { return [ [ @@ -142,7 +142,7 @@ public function testIsCheckedException( bool $expectedResult, ): void { - $resolver = new DefaultExceptionTypeResolver($this->createReflectionProvider(), $uncheckedExceptionRegexes, $uncheckedExceptionClasses, $checkedExceptionRegexes, $checkedExceptionClasses); + $resolver = new DefaultExceptionTypeResolver(self::createReflectionProvider(), $uncheckedExceptionRegexes, $uncheckedExceptionClasses, $checkedExceptionRegexes, $checkedExceptionClasses); $this->assertSame($expectedResult, $resolver->isCheckedException($className, self::getContainer()->getByType(ScopeFactory::class)->create(ScopeContext::create(__DIR__)))); } diff --git a/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRuleTest.php b/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRuleTest.php index 716e7b8687..5c0d007b84 100644 --- a/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRuleTest.php @@ -16,7 +16,7 @@ protected function getRule(): Rule { return new MissingCheckedExceptionInFunctionThrowsRule( new MissingCheckedExceptionInThrowsCheck(new DefaultExceptionTypeResolver( - $this->createReflectionProvider(), + self::createReflectionProvider(), [], [ShouldNotHappenException::class], [], diff --git a/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRuleTest.php b/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRuleTest.php index ba61e2900a..aee538052e 100644 --- a/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRuleTest.php @@ -18,7 +18,7 @@ protected function getRule(): Rule { return new MissingCheckedExceptionInMethodThrowsRule( new MissingCheckedExceptionInThrowsCheck(new DefaultExceptionTypeResolver( - $this->createReflectionProvider(), + self::createReflectionProvider(), [], [ShouldNotHappenException::class], [], diff --git a/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInPropertyHookThrowsRuleTest.php b/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInPropertyHookThrowsRuleTest.php index cf01fb3852..10af4b427f 100644 --- a/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInPropertyHookThrowsRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInPropertyHookThrowsRuleTest.php @@ -17,7 +17,7 @@ protected function getRule(): Rule { return new MissingCheckedExceptionInPropertyHookThrowsRule( new MissingCheckedExceptionInThrowsCheck(new DefaultExceptionTypeResolver( - $this->createReflectionProvider(), + self::createReflectionProvider(), [], [ShouldNotHappenException::class], [], diff --git a/tests/PHPStan/Rules/Exceptions/NoncapturingCatchRuleTest.php b/tests/PHPStan/Rules/Exceptions/NoncapturingCatchRuleTest.php index 8139960e66..669adcc172 100644 --- a/tests/PHPStan/Rules/Exceptions/NoncapturingCatchRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/NoncapturingCatchRuleTest.php @@ -18,7 +18,7 @@ protected function getRule(): Rule return new NoncapturingCatchRule(); } - public function dataRule(): array + public static function dataRule(): array { return [ [ diff --git a/tests/PHPStan/Rules/Exceptions/ThrowExprTypeRuleTest.php b/tests/PHPStan/Rules/Exceptions/ThrowExprTypeRuleTest.php index 69f97f9d0e..102409e5a2 100644 --- a/tests/PHPStan/Rules/Exceptions/ThrowExprTypeRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/ThrowExprTypeRuleTest.php @@ -15,7 +15,7 @@ class ThrowExprTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ThrowExprTypeRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true)); + return new ThrowExprTypeRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true)); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Exceptions/ThrowExpressionRuleTest.php b/tests/PHPStan/Rules/Exceptions/ThrowExpressionRuleTest.php index 1f32de8fe4..a45238c3e6 100644 --- a/tests/PHPStan/Rules/Exceptions/ThrowExpressionRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/ThrowExpressionRuleTest.php @@ -19,7 +19,7 @@ protected function getRule(): Rule return new ThrowExpressionRule($this->phpVersion); } - public function dataRule(): array + public static function dataRule(): array { return [ [ diff --git a/tests/PHPStan/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRuleTest.php b/tests/PHPStan/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRuleTest.php index ff6c4416a6..e2ae6dcac2 100644 --- a/tests/PHPStan/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRuleTest.php @@ -20,7 +20,7 @@ class ThrowsVoidFunctionWithExplicitThrowPointRuleTest extends RuleTestCase protected function getRule(): Rule { return new ThrowsVoidFunctionWithExplicitThrowPointRule(new DefaultExceptionTypeResolver( - $this->createReflectionProvider(), + self::createReflectionProvider(), [], [], [], @@ -28,7 +28,7 @@ protected function getRule(): Rule ), $this->missingCheckedExceptionInThrows); } - public function dataRule(): array + public static function dataRule(): array { return [ [ diff --git a/tests/PHPStan/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRuleTest.php b/tests/PHPStan/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRuleTest.php index 5a2dcb0429..005b087f2c 100644 --- a/tests/PHPStan/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRuleTest.php @@ -22,7 +22,7 @@ class ThrowsVoidMethodWithExplicitThrowPointRuleTest extends RuleTestCase protected function getRule(): Rule { return new ThrowsVoidMethodWithExplicitThrowPointRule(new DefaultExceptionTypeResolver( - $this->createReflectionProvider(), + self::createReflectionProvider(), [], [], [], @@ -30,7 +30,7 @@ protected function getRule(): Rule ), $this->missingCheckedExceptionInThrows); } - public function dataRule(): array + public static function dataRule(): array { return [ [ diff --git a/tests/PHPStan/Rules/Exceptions/ThrowsVoidPropertyHookWithExplicitThrowPointRuleTest.php b/tests/PHPStan/Rules/Exceptions/ThrowsVoidPropertyHookWithExplicitThrowPointRuleTest.php index 6072db088b..86fc804bfe 100644 --- a/tests/PHPStan/Rules/Exceptions/ThrowsVoidPropertyHookWithExplicitThrowPointRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/ThrowsVoidPropertyHookWithExplicitThrowPointRuleTest.php @@ -20,7 +20,7 @@ class ThrowsVoidPropertyHookWithExplicitThrowPointRuleTest extends RuleTestCase protected function getRule(): Rule { return new ThrowsVoidPropertyHookWithExplicitThrowPointRule(new DefaultExceptionTypeResolver( - $this->createReflectionProvider(), + self::createReflectionProvider(), [], [], [], @@ -28,7 +28,7 @@ protected function getRule(): Rule ), $this->missingCheckedExceptionInThrows); } - public function dataRule(): array + public static function dataRule(): array { return [ [ diff --git a/tests/PHPStan/Rules/Functions/ArrayFilterRuleTest.php b/tests/PHPStan/Rules/Functions/ArrayFilterRuleTest.php index e0a51fc2a8..96be9603a8 100644 --- a/tests/PHPStan/Rules/Functions/ArrayFilterRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ArrayFilterRuleTest.php @@ -16,7 +16,7 @@ class ArrayFilterRuleTest extends RuleTestCase protected function getRule(): Rule { return new ArrayFilterRule( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->treatPhpDocTypesAsCertain, true, ); diff --git a/tests/PHPStan/Rules/Functions/ArrayValuesRuleTest.php b/tests/PHPStan/Rules/Functions/ArrayValuesRuleTest.php index ec6ed43e38..face9ea8f5 100644 --- a/tests/PHPStan/Rules/Functions/ArrayValuesRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ArrayValuesRuleTest.php @@ -17,7 +17,7 @@ class ArrayValuesRuleTest extends RuleTestCase protected function getRule(): Rule { return new ArrayValuesRule( - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->treatPhpDocTypesAsCertain, true, ); diff --git a/tests/PHPStan/Rules/Functions/ArrowFunctionAttributesRuleTest.php b/tests/PHPStan/Rules/Functions/ArrowFunctionAttributesRuleTest.php index a46163b89c..64ce4730fe 100644 --- a/tests/PHPStan/Rules/Functions/ArrowFunctionAttributesRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ArrowFunctionAttributesRuleTest.php @@ -22,7 +22,7 @@ class ArrowFunctionAttributesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ArrowFunctionAttributesRule( new AttributesCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Functions/ArrowFunctionReturnTypeRuleTest.php b/tests/PHPStan/Rules/Functions/ArrowFunctionReturnTypeRuleTest.php index a5f2fa7232..3415bfa8dd 100644 --- a/tests/PHPStan/Rules/Functions/ArrowFunctionReturnTypeRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ArrowFunctionReturnTypeRuleTest.php @@ -17,7 +17,7 @@ class ArrowFunctionReturnTypeRuleTest extends RuleTestCase protected function getRule(): Rule { return new ArrowFunctionReturnTypeRule(new FunctionReturnTypeCheck(new RuleLevelHelper( - $this->createReflectionProvider(), + self::createReflectionProvider(), true, false, true, diff --git a/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php b/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php index 26b4a4b906..f62a03d4ea 100644 --- a/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php @@ -21,7 +21,7 @@ class CallCallablesRuleTest extends RuleTestCase protected function getRule(): Rule { - $ruleLevelHelper = new RuleLevelHelper($this->createReflectionProvider(), true, false, true, $this->checkExplicitMixed, false, false, true); + $ruleLevelHelper = new RuleLevelHelper(self::createReflectionProvider(), true, false, true, $this->checkExplicitMixed, false, false, true); return new CallCallablesRule( new FunctionCallParametersCheck( $ruleLevelHelper, @@ -188,7 +188,7 @@ public function testNamedArguments(): void ]); } - public function dataBug3566(): array + public static function dataBug3566(): array { return [ [ diff --git a/tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php b/tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php index 7d83fec5f9..1c726b0ea3 100644 --- a/tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php @@ -24,7 +24,7 @@ class CallToFunctionParametersRuleTest extends RuleTestCase protected function getRule(): Rule { - $broker = $this->createReflectionProvider(); + $broker = self::createReflectionProvider(); return new CallToFunctionParametersRule( $broker, new FunctionCallParametersCheck(new RuleLevelHelper($broker, true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true), new NullsafeCheck(), new UnresolvableTypeHelper(), new PropertyReflectionFinder(), true, true, true, true), @@ -844,7 +844,7 @@ public function testBug5609(): void $this->analyse([__DIR__ . '/data/bug-5609.php'], []); } - public function dataArrayMapMultiple(): array + public static function dataArrayMapMultiple(): array { return [ [true], @@ -866,7 +866,7 @@ public function testArrayMapMultiple(bool $checkExplicitMixed): void ]); } - public function dataArrayFilterCallback(): array + public static function dataArrayFilterCallback(): array { return [ [true], diff --git a/tests/PHPStan/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRuleTest.php b/tests/PHPStan/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRuleTest.php index 85c1f400ee..28257e5a80 100644 --- a/tests/PHPStan/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRuleTest.php @@ -14,7 +14,7 @@ class CallToFunctionStatementWithoutSideEffectsRuleTest extends RuleTestCase protected function getRule(): Rule { - return new CallToFunctionStatementWithoutSideEffectsRule($this->createReflectionProvider()); + return new CallToFunctionStatementWithoutSideEffectsRule(self::createReflectionProvider()); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php b/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php index 6707068e04..bd5d50733e 100644 --- a/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php @@ -14,7 +14,7 @@ class CallToNonExistentFunctionRuleTest extends RuleTestCase protected function getRule(): Rule { - return new CallToNonExistentFunctionRule($this->createReflectionProvider(), true, true); + return new CallToNonExistentFunctionRule(self::createReflectionProvider(), true, true); } public function shouldNarrowMethodScopeFromConstructor(): bool diff --git a/tests/PHPStan/Rules/Functions/CallUserFuncRuleTest.php b/tests/PHPStan/Rules/Functions/CallUserFuncRuleTest.php index 7ee37a1458..25be7474e2 100644 --- a/tests/PHPStan/Rules/Functions/CallUserFuncRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallUserFuncRuleTest.php @@ -19,7 +19,7 @@ class CallUserFuncRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new CallUserFuncRule($reflectionProvider, new FunctionCallParametersCheck(new RuleLevelHelper($reflectionProvider, true, false, true, true, false, false, true), new NullsafeCheck(), new UnresolvableTypeHelper(), new PropertyReflectionFinder(), true, true, true, true)); } diff --git a/tests/PHPStan/Rules/Functions/ClosureAttributesRuleTest.php b/tests/PHPStan/Rules/Functions/ClosureAttributesRuleTest.php index 360ed89a3c..659659449e 100644 --- a/tests/PHPStan/Rules/Functions/ClosureAttributesRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ClosureAttributesRuleTest.php @@ -22,7 +22,7 @@ class ClosureAttributesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ClosureAttributesRule( new AttributesCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Functions/ClosureReturnTypeRuleTest.php b/tests/PHPStan/Rules/Functions/ClosureReturnTypeRuleTest.php index 938020a0ba..38d4ec65d8 100644 --- a/tests/PHPStan/Rules/Functions/ClosureReturnTypeRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ClosureReturnTypeRuleTest.php @@ -15,7 +15,7 @@ class ClosureReturnTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ClosureReturnTypeRule(new FunctionReturnTypeCheck(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true))); + return new ClosureReturnTypeRule(new FunctionReturnTypeCheck(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true))); } public function testClosureReturnTypeRule(): void diff --git a/tests/PHPStan/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRuleTest.php b/tests/PHPStan/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRuleTest.php index 158d763831..86a0b46f4f 100644 --- a/tests/PHPStan/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRuleTest.php @@ -22,7 +22,7 @@ class ExistingClassesInArrowFunctionTypehintsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassesInArrowFunctionTypehintsRule( new FunctionDefinitionCheck( $reflectionProvider, @@ -55,7 +55,7 @@ public function testRule(): void ]); } - public function dataNativeUnionTypes(): array + public static function dataNativeUnionTypes(): array { return [ [ @@ -88,7 +88,7 @@ public function testNativeUnionTypes(int $phpVersionId, array $errors): void $this->analyse([__DIR__ . '/data/native-union-types.php'], $errors); } - public function dataRequiredParameterAfterOptional(): array + public static function dataRequiredParameterAfterOptional(): array { return [ [ @@ -252,7 +252,7 @@ public function testRequiredParameterAfterOptional(int $phpVersionId, array $err $this->analyse([__DIR__ . '/data/required-parameter-after-optional-arrow.php'], $errors); } - public function dataIntersectionTypes(): array + public static function dataIntersectionTypes(): array { return [ [80000, []], diff --git a/tests/PHPStan/Rules/Functions/ExistingClassesInClosureTypehintsRuleTest.php b/tests/PHPStan/Rules/Functions/ExistingClassesInClosureTypehintsRuleTest.php index 988b42b6a9..f5318f9002 100644 --- a/tests/PHPStan/Rules/Functions/ExistingClassesInClosureTypehintsRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ExistingClassesInClosureTypehintsRuleTest.php @@ -22,7 +22,7 @@ class ExistingClassesInClosureTypehintsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassesInClosureTypehintsRule( new FunctionDefinitionCheck( $reflectionProvider, @@ -99,7 +99,7 @@ public function testVoidParameterTypehint(): void ]); } - public function dataNativeUnionTypes(): array + public static function dataNativeUnionTypes(): array { return [ [ @@ -132,7 +132,7 @@ public function testNativeUnionTypes(int $phpVersionId, array $errors): void $this->analyse([__DIR__ . '/data/native-union-types.php'], $errors); } - public function dataRequiredParameterAfterOptional(): array + public static function dataRequiredParameterAfterOptional(): array { return [ [ @@ -296,7 +296,7 @@ public function testRequiredParameterAfterOptional(int $phpVersionId, array $err $this->analyse([__DIR__ . '/data/required-parameter-after-optional-closures.php'], $errors); } - public function dataIntersectionTypes(): array + public static function dataIntersectionTypes(): array { return [ [80000, []], diff --git a/tests/PHPStan/Rules/Functions/ExistingClassesInTypehintsRuleTest.php b/tests/PHPStan/Rules/Functions/ExistingClassesInTypehintsRuleTest.php index a1a6beb6d0..6d63bbfd65 100644 --- a/tests/PHPStan/Rules/Functions/ExistingClassesInTypehintsRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ExistingClassesInTypehintsRuleTest.php @@ -22,7 +22,7 @@ class ExistingClassesInTypehintsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassesInTypehintsRule( new FunctionDefinitionCheck( $reflectionProvider, @@ -180,7 +180,7 @@ public function testVoidParameterTypehint(): void ]); } - public function dataNativeUnionTypes(): array + public static function dataNativeUnionTypes(): array { return [ [ @@ -213,7 +213,7 @@ public function testNativeUnionTypes(int $phpVersionId, array $errors): void $this->analyse([__DIR__ . '/data/native-union-types.php'], $errors); } - public function dataRequiredParameterAfterOptional(): array + public static function dataRequiredParameterAfterOptional(): array { return [ [ @@ -377,7 +377,7 @@ public function testRequiredParameterAfterOptional(int $phpVersionId, array $err $this->analyse([__DIR__ . '/data/required-parameter-after-optional.php'], $errors); } - public function dataIntersectionTypes(): array + public static function dataIntersectionTypes(): array { return [ [80000, []], diff --git a/tests/PHPStan/Rules/Functions/FunctionAttributesRuleTest.php b/tests/PHPStan/Rules/Functions/FunctionAttributesRuleTest.php index 2fc38ca188..0ad48b3e98 100644 --- a/tests/PHPStan/Rules/Functions/FunctionAttributesRuleTest.php +++ b/tests/PHPStan/Rules/Functions/FunctionAttributesRuleTest.php @@ -22,7 +22,7 @@ class FunctionAttributesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new FunctionAttributesRule( new AttributesCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Functions/FunctionCallableRuleTest.php b/tests/PHPStan/Rules/Functions/FunctionCallableRuleTest.php index 18bd5ed206..54fad29b4d 100644 --- a/tests/PHPStan/Rules/Functions/FunctionCallableRuleTest.php +++ b/tests/PHPStan/Rules/Functions/FunctionCallableRuleTest.php @@ -16,7 +16,7 @@ class FunctionCallableRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new FunctionCallableRule( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Functions/ImplodeParameterCastableToStringRuleTest.php b/tests/PHPStan/Rules/Functions/ImplodeParameterCastableToStringRuleTest.php index 8f2d3415b6..65194fa040 100644 --- a/tests/PHPStan/Rules/Functions/ImplodeParameterCastableToStringRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ImplodeParameterCastableToStringRuleTest.php @@ -16,7 +16,7 @@ class ImplodeParameterCastableToStringRuleTest extends RuleTestCase protected function getRule(): Rule { - $broker = $this->createReflectionProvider(); + $broker = self::createReflectionProvider(); return new ImplodeParameterCastableToStringRule($broker, new ParameterCastableToStringCheck(new RuleLevelHelper($broker, true, false, true, true, true, false, true))); } diff --git a/tests/PHPStan/Rules/Functions/ParamAttributesRuleTest.php b/tests/PHPStan/Rules/Functions/ParamAttributesRuleTest.php index 7f8e3cef19..0b0296bc6a 100644 --- a/tests/PHPStan/Rules/Functions/ParamAttributesRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ParamAttributesRuleTest.php @@ -22,7 +22,7 @@ class ParamAttributesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ParamAttributesRule( new AttributesCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Functions/ParameterCastableToNumberRuleTest.php b/tests/PHPStan/Rules/Functions/ParameterCastableToNumberRuleTest.php index e652375414..fbc5128807 100644 --- a/tests/PHPStan/Rules/Functions/ParameterCastableToNumberRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ParameterCastableToNumberRuleTest.php @@ -18,7 +18,7 @@ class ParameterCastableToNumberRuleTest extends RuleTestCase protected function getRule(): Rule { - $broker = $this->createReflectionProvider(); + $broker = self::createReflectionProvider(); return new ParameterCastableToNumberRule($broker, new ParameterCastableToStringCheck(new RuleLevelHelper($broker, true, false, true, true, true, false, true))); } diff --git a/tests/PHPStan/Rules/Functions/ParameterCastableToStringRuleTest.php b/tests/PHPStan/Rules/Functions/ParameterCastableToStringRuleTest.php index 368ce6b286..04eb4fb308 100644 --- a/tests/PHPStan/Rules/Functions/ParameterCastableToStringRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ParameterCastableToStringRuleTest.php @@ -18,7 +18,7 @@ class ParameterCastableToStringRuleTest extends RuleTestCase protected function getRule(): Rule { - $broker = $this->createReflectionProvider(); + $broker = self::createReflectionProvider(); return new ParameterCastableToStringRule($broker, new ParameterCastableToStringCheck(new RuleLevelHelper($broker, true, false, true, true, true, false, true))); } diff --git a/tests/PHPStan/Rules/Functions/PrintfArrayParametersRuleTest.php b/tests/PHPStan/Rules/Functions/PrintfArrayParametersRuleTest.php index d9f2375bfc..d799e58579 100644 --- a/tests/PHPStan/Rules/Functions/PrintfArrayParametersRuleTest.php +++ b/tests/PHPStan/Rules/Functions/PrintfArrayParametersRuleTest.php @@ -17,7 +17,7 @@ protected function getRule(): Rule { return new PrintfArrayParametersRule( new PrintfHelper(new PhpVersion(PHP_VERSION_ID)), - $this->createReflectionProvider(), + self::createReflectionProvider(), ); } diff --git a/tests/PHPStan/Rules/Functions/PrintfParametersRuleTest.php b/tests/PHPStan/Rules/Functions/PrintfParametersRuleTest.php index 252f2919ec..d60b1e0be6 100644 --- a/tests/PHPStan/Rules/Functions/PrintfParametersRuleTest.php +++ b/tests/PHPStan/Rules/Functions/PrintfParametersRuleTest.php @@ -17,7 +17,7 @@ protected function getRule(): Rule { return new PrintfParametersRule( new PrintfHelper(new PhpVersion(PHP_VERSION_ID)), - $this->createReflectionProvider(), + self::createReflectionProvider(), ); } diff --git a/tests/PHPStan/Rules/Functions/RandomIntParametersRuleTest.php b/tests/PHPStan/Rules/Functions/RandomIntParametersRuleTest.php index 40c0526e25..39160f054f 100644 --- a/tests/PHPStan/Rules/Functions/RandomIntParametersRuleTest.php +++ b/tests/PHPStan/Rules/Functions/RandomIntParametersRuleTest.php @@ -15,7 +15,7 @@ class RandomIntParametersRuleTest extends RuleTestCase protected function getRule(): Rule { - return new RandomIntParametersRule($this->createReflectionProvider(), new PhpVersion(80000), true); + return new RandomIntParametersRule(self::createReflectionProvider(), new PhpVersion(80000), true); } public function testFile(): void diff --git a/tests/PHPStan/Rules/Functions/ReturnTypeRuleTest.php b/tests/PHPStan/Rules/Functions/ReturnTypeRuleTest.php index b5ca981736..95566979c8 100644 --- a/tests/PHPStan/Rules/Functions/ReturnTypeRuleTest.php +++ b/tests/PHPStan/Rules/Functions/ReturnTypeRuleTest.php @@ -20,7 +20,7 @@ class ReturnTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ReturnTypeRule(new FunctionReturnTypeCheck(new RuleLevelHelper($this->createReflectionProvider(), $this->checkNullables, false, true, $this->checkExplicitMixed, false, false, true))); + return new ReturnTypeRule(new FunctionReturnTypeCheck(new RuleLevelHelper(self::createReflectionProvider(), $this->checkNullables, false, true, $this->checkExplicitMixed, false, false, true))); } public function testReturnTypeRule(): void diff --git a/tests/PHPStan/Rules/Functions/SortParameterCastableToStringRuleTest.php b/tests/PHPStan/Rules/Functions/SortParameterCastableToStringRuleTest.php index 6aee2ae8a3..ea3ad2d00b 100644 --- a/tests/PHPStan/Rules/Functions/SortParameterCastableToStringRuleTest.php +++ b/tests/PHPStan/Rules/Functions/SortParameterCastableToStringRuleTest.php @@ -18,7 +18,7 @@ class SortParameterCastableToStringRuleTest extends RuleTestCase protected function getRule(): Rule { - $broker = $this->createReflectionProvider(); + $broker = self::createReflectionProvider(); return new SortParameterCastableToStringRule($broker, new ParameterCastableToStringCheck(new RuleLevelHelper($broker, true, false, true, true, true, false, true))); } diff --git a/tests/PHPStan/Rules/Functions/UnusedClosureUsesRuleTest.php b/tests/PHPStan/Rules/Functions/UnusedClosureUsesRuleTest.php index 38a555afda..137257162c 100644 --- a/tests/PHPStan/Rules/Functions/UnusedClosureUsesRuleTest.php +++ b/tests/PHPStan/Rules/Functions/UnusedClosureUsesRuleTest.php @@ -14,7 +14,7 @@ class UnusedClosureUsesRuleTest extends RuleTestCase protected function getRule(): Rule { - return new UnusedClosureUsesRule(new UnusedFunctionParametersCheck($this->createReflectionProvider(), true)); + return new UnusedClosureUsesRule(new UnusedFunctionParametersCheck(self::createReflectionProvider(), true)); } public function testUnusedClosureUses(): void diff --git a/tests/PHPStan/Rules/Functions/UselessFunctionReturnValueRuleTest.php b/tests/PHPStan/Rules/Functions/UselessFunctionReturnValueRuleTest.php index 422103bd37..545bf6c061 100644 --- a/tests/PHPStan/Rules/Functions/UselessFunctionReturnValueRuleTest.php +++ b/tests/PHPStan/Rules/Functions/UselessFunctionReturnValueRuleTest.php @@ -15,7 +15,7 @@ class UselessFunctionReturnValueRuleTest extends RuleTestCase protected function getRule(): Rule { return new UselessFunctionReturnValueRule( - $this->createReflectionProvider(), + self::createReflectionProvider(), ); } diff --git a/tests/PHPStan/Rules/Generators/YieldFromTypeRuleTest.php b/tests/PHPStan/Rules/Generators/YieldFromTypeRuleTest.php index cade4c576b..4a70fea824 100644 --- a/tests/PHPStan/Rules/Generators/YieldFromTypeRuleTest.php +++ b/tests/PHPStan/Rules/Generators/YieldFromTypeRuleTest.php @@ -14,7 +14,7 @@ class YieldFromTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - return new YieldFromTypeRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true), true); + return new YieldFromTypeRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true), true); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Generators/YieldTypeRuleTest.php b/tests/PHPStan/Rules/Generators/YieldTypeRuleTest.php index 500199d28e..c35ec06136 100644 --- a/tests/PHPStan/Rules/Generators/YieldTypeRuleTest.php +++ b/tests/PHPStan/Rules/Generators/YieldTypeRuleTest.php @@ -14,7 +14,7 @@ class YieldTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - return new YieldTypeRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true)); + return new YieldTypeRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true)); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Generics/ClassAncestorsRuleTest.php b/tests/PHPStan/Rules/Generics/ClassAncestorsRuleTest.php index dd82f5bada..075c3fa6c2 100644 --- a/tests/PHPStan/Rules/Generics/ClassAncestorsRuleTest.php +++ b/tests/PHPStan/Rules/Generics/ClassAncestorsRuleTest.php @@ -16,7 +16,7 @@ protected function getRule(): Rule { return new ClassAncestorsRule( new GenericAncestorsCheck( - $this->createReflectionProvider(), + self::createReflectionProvider(), new GenericObjectTypeCheck(), new VarianceCheck(), new UnresolvableTypeHelper(), diff --git a/tests/PHPStan/Rules/Generics/ClassTemplateTypeRuleTest.php b/tests/PHPStan/Rules/Generics/ClassTemplateTypeRuleTest.php index 0ef409ddf8..e08f5e82b6 100644 --- a/tests/PHPStan/Rules/Generics/ClassTemplateTypeRuleTest.php +++ b/tests/PHPStan/Rules/Generics/ClassTemplateTypeRuleTest.php @@ -17,7 +17,7 @@ class ClassTemplateTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $typeAliasResolver = $this->createTypeAliasResolver(['TypeAlias' => 'int'], $reflectionProvider); return new ClassTemplateTypeRule( diff --git a/tests/PHPStan/Rules/Generics/EnumAncestorsRuleTest.php b/tests/PHPStan/Rules/Generics/EnumAncestorsRuleTest.php index 18181f9bae..41fc7bf0ce 100644 --- a/tests/PHPStan/Rules/Generics/EnumAncestorsRuleTest.php +++ b/tests/PHPStan/Rules/Generics/EnumAncestorsRuleTest.php @@ -17,7 +17,7 @@ protected function getRule(): Rule { return new EnumAncestorsRule( new GenericAncestorsCheck( - $this->createReflectionProvider(), + self::createReflectionProvider(), new GenericObjectTypeCheck(), new VarianceCheck(), new UnresolvableTypeHelper(), diff --git a/tests/PHPStan/Rules/Generics/FunctionTemplateTypeRuleTest.php b/tests/PHPStan/Rules/Generics/FunctionTemplateTypeRuleTest.php index af46e7e0f5..f7a818012a 100644 --- a/tests/PHPStan/Rules/Generics/FunctionTemplateTypeRuleTest.php +++ b/tests/PHPStan/Rules/Generics/FunctionTemplateTypeRuleTest.php @@ -17,7 +17,7 @@ class FunctionTemplateTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $typeAliasResolver = $this->createTypeAliasResolver(['TypeAlias' => 'int'], $reflectionProvider); return new FunctionTemplateTypeRule( diff --git a/tests/PHPStan/Rules/Generics/InterfaceAncestorsRuleTest.php b/tests/PHPStan/Rules/Generics/InterfaceAncestorsRuleTest.php index f82610ea0b..0fe5c98ba1 100644 --- a/tests/PHPStan/Rules/Generics/InterfaceAncestorsRuleTest.php +++ b/tests/PHPStan/Rules/Generics/InterfaceAncestorsRuleTest.php @@ -16,7 +16,7 @@ protected function getRule(): Rule { return new InterfaceAncestorsRule( new GenericAncestorsCheck( - $this->createReflectionProvider(), + self::createReflectionProvider(), new GenericObjectTypeCheck(), new VarianceCheck(), new UnresolvableTypeHelper(), diff --git a/tests/PHPStan/Rules/Generics/InterfaceTemplateTypeRuleTest.php b/tests/PHPStan/Rules/Generics/InterfaceTemplateTypeRuleTest.php index 3823a214f7..e4c0da47f3 100644 --- a/tests/PHPStan/Rules/Generics/InterfaceTemplateTypeRuleTest.php +++ b/tests/PHPStan/Rules/Generics/InterfaceTemplateTypeRuleTest.php @@ -16,7 +16,7 @@ class InterfaceTemplateTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $typeAliasResolver = $this->createTypeAliasResolver(['TypeAlias' => 'int'], $reflectionProvider); return new InterfaceTemplateTypeRule( diff --git a/tests/PHPStan/Rules/Generics/MethodTagTemplateTypeRuleTest.php b/tests/PHPStan/Rules/Generics/MethodTagTemplateTypeRuleTest.php index 758c11548d..c936422dce 100644 --- a/tests/PHPStan/Rules/Generics/MethodTagTemplateTypeRuleTest.php +++ b/tests/PHPStan/Rules/Generics/MethodTagTemplateTypeRuleTest.php @@ -17,7 +17,7 @@ class MethodTagTemplateTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $typeAliasResolver = $this->createTypeAliasResolver(['TypeAlias' => 'int'], $reflectionProvider); return new MethodTagTemplateTypeRule( diff --git a/tests/PHPStan/Rules/Generics/MethodTagTemplateTypeTraitRuleTest.php b/tests/PHPStan/Rules/Generics/MethodTagTemplateTypeTraitRuleTest.php index 470d48adc5..f26d3e1611 100644 --- a/tests/PHPStan/Rules/Generics/MethodTagTemplateTypeTraitRuleTest.php +++ b/tests/PHPStan/Rules/Generics/MethodTagTemplateTypeTraitRuleTest.php @@ -17,7 +17,7 @@ class MethodTagTemplateTypeTraitRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $typeAliasResolver = $this->createTypeAliasResolver(['TypeAlias' => 'int'], $reflectionProvider); return new MethodTagTemplateTypeTraitRule( diff --git a/tests/PHPStan/Rules/Generics/MethodTemplateTypeRuleTest.php b/tests/PHPStan/Rules/Generics/MethodTemplateTypeRuleTest.php index 8450ba5f3e..d8b9b5a909 100644 --- a/tests/PHPStan/Rules/Generics/MethodTemplateTypeRuleTest.php +++ b/tests/PHPStan/Rules/Generics/MethodTemplateTypeRuleTest.php @@ -17,7 +17,7 @@ class MethodTemplateTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $typeAliasResolver = $this->createTypeAliasResolver(['TypeAlias' => 'int'], $reflectionProvider); return new MethodTemplateTypeRule( diff --git a/tests/PHPStan/Rules/Generics/TraitTemplateTypeRuleTest.php b/tests/PHPStan/Rules/Generics/TraitTemplateTypeRuleTest.php index 335e1f707c..f40914464b 100644 --- a/tests/PHPStan/Rules/Generics/TraitTemplateTypeRuleTest.php +++ b/tests/PHPStan/Rules/Generics/TraitTemplateTypeRuleTest.php @@ -17,7 +17,7 @@ class TraitTemplateTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $typeAliasResolver = $this->createTypeAliasResolver(['TypeAlias' => 'int'], $reflectionProvider); return new TraitTemplateTypeRule( diff --git a/tests/PHPStan/Rules/Generics/UsedTraitsRuleTest.php b/tests/PHPStan/Rules/Generics/UsedTraitsRuleTest.php index 76dc75145f..783d238b53 100644 --- a/tests/PHPStan/Rules/Generics/UsedTraitsRuleTest.php +++ b/tests/PHPStan/Rules/Generics/UsedTraitsRuleTest.php @@ -18,7 +18,7 @@ protected function getRule(): Rule return new UsedTraitsRule( self::getContainer()->getByType(FileTypeMapper::class), new GenericAncestorsCheck( - $this->createReflectionProvider(), + self::createReflectionProvider(), new GenericObjectTypeCheck(), new VarianceCheck(), new UnresolvableTypeHelper(), diff --git a/tests/PHPStan/Rules/Methods/AbstractMethodInNonAbstractClassRuleTest.php b/tests/PHPStan/Rules/Methods/AbstractMethodInNonAbstractClassRuleTest.php index 7ec5a8d7f4..01c8541922 100644 --- a/tests/PHPStan/Rules/Methods/AbstractMethodInNonAbstractClassRuleTest.php +++ b/tests/PHPStan/Rules/Methods/AbstractMethodInNonAbstractClassRuleTest.php @@ -45,7 +45,7 @@ public function testBug3406(): void public function testBug3406ReflectionCheck(): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $reflection = $reflectionProvider->getClass(ClassFoo::class); $this->assertSame(AbstractFoo::class, $reflection->getNativeMethod('myFoo')->getDeclaringClass()->getName()); $this->assertSame(ClassFoo::class, $reflection->getNativeMethod('myBar')->getDeclaringClass()->getName()); diff --git a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php index decb237d34..9c22e7df46 100644 --- a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php @@ -29,7 +29,7 @@ class CallMethodsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $ruleLevelHelper = new RuleLevelHelper($reflectionProvider, $this->checkNullables, $this->checkThisOnly, $this->checkUnionTypes, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true); return new CallMethodsRule( new MethodCallCheck($reflectionProvider, $ruleLevelHelper, true, true), @@ -1309,7 +1309,7 @@ public function testCallMethodsNullIssue(): void $this->analyse([__DIR__ . '/data/order.php'], []); } - public function dataIterable(): array + public static function dataIterable(): array { return [ [ @@ -1552,7 +1552,7 @@ public function testShadowedTraitMethod(): void $this->analyse([__DIR__ . '/data/shadowed-trait-method.php'], []); } - public function dataExplicitMixed(): array + public static function dataExplicitMixed(): array { return [ [ @@ -1609,7 +1609,7 @@ public function testExplicitMixed(bool $checkExplicitMixed, array $errors): void $this->analyse([__DIR__ . '/data/check-explicit-mixed.php'], $errors); } - public function dataImplicitMixed(): array + public static function dataImplicitMixed(): array { return [ [ @@ -2890,7 +2890,7 @@ public function testBug8752(): void ]); } - public function dataCallablesWithoutCheckNullables(): iterable + public static function dataCallablesWithoutCheckNullables(): iterable { yield [false, false, []]; yield [true, false, []]; diff --git a/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php b/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php index b9999f8610..8c35bc05f8 100644 --- a/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php @@ -30,7 +30,7 @@ class CallStaticMethodsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $ruleLevelHelper = new RuleLevelHelper($reflectionProvider, true, $this->checkThisOnly, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true); return new CallStaticMethodsRule( new StaticMethodCallCheck( @@ -674,7 +674,7 @@ public function testRequireImplements(): void ]); } - public function dataMixed(): array + public static function dataMixed(): array { $explicitOnlyErrors = [ [ diff --git a/tests/PHPStan/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRuleTest.php b/tests/PHPStan/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRuleTest.php index c7c0e8f89a..8c7216ed4c 100644 --- a/tests/PHPStan/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRuleTest.php @@ -13,7 +13,7 @@ class CallToConstructorStatementWithoutSideEffectsRuleTest extends RuleTestCase protected function getRule(): Rule { - return new CallToConstructorStatementWithoutSideEffectsRule($this->createReflectionProvider()); + return new CallToConstructorStatementWithoutSideEffectsRule(self::createReflectionProvider()); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Methods/CallToMethodStatementWithoutSideEffectsRuleTest.php b/tests/PHPStan/Rules/Methods/CallToMethodStatementWithoutSideEffectsRuleTest.php index 67bd722602..a160bfcea7 100644 --- a/tests/PHPStan/Rules/Methods/CallToMethodStatementWithoutSideEffectsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallToMethodStatementWithoutSideEffectsRuleTest.php @@ -16,7 +16,7 @@ class CallToMethodStatementWithoutSideEffectsRuleTest extends RuleTestCase protected function getRule(): Rule { - return new CallToMethodStatementWithoutSideEffectsRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true)); + return new CallToMethodStatementWithoutSideEffectsRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true)); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRuleTest.php b/tests/PHPStan/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRuleTest.php index 1fa0216870..bec56ff7d6 100644 --- a/tests/PHPStan/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRuleTest.php @@ -14,7 +14,7 @@ class CallToStaticMethodStatementWithoutSideEffectsRuleTest extends RuleTestCase protected function getRule(): Rule { - $broker = $this->createReflectionProvider(); + $broker = self::createReflectionProvider(); return new CallToStaticMethodStatementWithoutSideEffectsRule( new RuleLevelHelper($broker, true, false, true, false, false, false, true), $broker, diff --git a/tests/PHPStan/Rules/Methods/ExistingClassesInTypehintsRuleTest.php b/tests/PHPStan/Rules/Methods/ExistingClassesInTypehintsRuleTest.php index 170920bbf6..4c782cfcbb 100644 --- a/tests/PHPStan/Rules/Methods/ExistingClassesInTypehintsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/ExistingClassesInTypehintsRuleTest.php @@ -22,7 +22,7 @@ class ExistingClassesInTypehintsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassesInTypehintsRule( new FunctionDefinitionCheck( $reflectionProvider, @@ -174,7 +174,7 @@ public function testVoidParameterTypehint(): void ]); } - public function dataNativeUnionTypes(): array + public static function dataNativeUnionTypes(): array { return [ [ @@ -207,7 +207,7 @@ public function testNativeUnionTypes(int $phpVersionId, array $errors): void $this->analyse([__DIR__ . '/data/native-union-types.php'], $errors); } - public function dataRequiredParameterAfterOptional(): array + public static function dataRequiredParameterAfterOptional(): array { return [ [ @@ -381,7 +381,7 @@ public function testBug4641(): void ]); } - public function dataIntersectionTypes(): array + public static function dataIntersectionTypes(): array { return [ [80000, []], diff --git a/tests/PHPStan/Rules/Methods/FinalPrivateMethodRuleTest.php b/tests/PHPStan/Rules/Methods/FinalPrivateMethodRuleTest.php index 05be45a380..9c56dbcb36 100644 --- a/tests/PHPStan/Rules/Methods/FinalPrivateMethodRuleTest.php +++ b/tests/PHPStan/Rules/Methods/FinalPrivateMethodRuleTest.php @@ -16,7 +16,7 @@ protected function getRule(): Rule return new FinalPrivateMethodRule(); } - public function dataRule(): array + public static function dataRule(): array { return [ [ diff --git a/tests/PHPStan/Rules/Methods/MethodAttributesRuleTest.php b/tests/PHPStan/Rules/Methods/MethodAttributesRuleTest.php index b2a85a50c3..b495431f7c 100644 --- a/tests/PHPStan/Rules/Methods/MethodAttributesRuleTest.php +++ b/tests/PHPStan/Rules/Methods/MethodAttributesRuleTest.php @@ -22,7 +22,7 @@ class MethodAttributesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new MethodAttributesRule( new AttributesCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Methods/MethodCallableRuleTest.php b/tests/PHPStan/Rules/Methods/MethodCallableRuleTest.php index 8b558e4512..19f26d13b9 100644 --- a/tests/PHPStan/Rules/Methods/MethodCallableRuleTest.php +++ b/tests/PHPStan/Rules/Methods/MethodCallableRuleTest.php @@ -18,7 +18,7 @@ class MethodCallableRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $ruleLevelHelper = new RuleLevelHelper($reflectionProvider, true, false, true, false, false, false, true); return new MethodCallableRule( diff --git a/tests/PHPStan/Rules/Methods/OverridingMethodRuleTest.php b/tests/PHPStan/Rules/Methods/OverridingMethodRuleTest.php index 23df75cf0a..330f59cd38 100644 --- a/tests/PHPStan/Rules/Methods/OverridingMethodRuleTest.php +++ b/tests/PHPStan/Rules/Methods/OverridingMethodRuleTest.php @@ -37,7 +37,7 @@ protected function getRule(): Rule ); } - public function dataOverridingFinalMethod(): array + public static function dataOverridingFinalMethod(): array { return [ [ @@ -145,7 +145,7 @@ public function testOverridingFinalMethod(int $phpVersion, string $contravariant $this->analyse([__DIR__ . '/data/overriding-method.php'], $errors); } - public function dataParameterContravariance(): array + public static function dataParameterContravariance(): array { return [ [ @@ -245,7 +245,7 @@ public function testParameterContravariance( $this->analyse([$file], $expectedErrors); } - public function dataReturnTypeCovariance(): array + public static function dataReturnTypeCovariance(): array { return [ [ @@ -378,7 +378,7 @@ public function testVariadics(): void $this->analyse([__DIR__ . '/data/overriding-variadics.php'], $errors); } - public function dataLessOverridenParametersWithVariadic(): array + public static function dataLessOverridenParametersWithVariadic(): array { return [ [ @@ -444,7 +444,7 @@ public function testLessOverridenParametersWithVariadic(int $phpVersionId, array $this->analyse([__DIR__ . '/data/less-parameters-variadics.php'], $errors); } - public function dataParameterTypeWidening(): array + public static function dataParameterTypeWidening(): array { return [ [ @@ -479,7 +479,7 @@ public function testBug4516(): void $this->analyse([__DIR__ . '/data/bug-4516.php'], []); } - public function dataTentativeReturnTypes(): array + public static function dataTentativeReturnTypes(): array { return [ [70400, []], @@ -758,7 +758,7 @@ public function testOverrideAttribute(): void ]); } - public function dataCheckMissingOverrideAttribute(): iterable + public static function dataCheckMissingOverrideAttribute(): iterable { yield [false, 80000, []]; yield [true, 80000, []]; diff --git a/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php b/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php index ec7bf57f05..ead208531f 100644 --- a/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php +++ b/tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php @@ -22,7 +22,7 @@ class ReturnTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ReturnTypeRule(new FunctionReturnTypeCheck(new RuleLevelHelper($this->createReflectionProvider(), true, false, $this->checkUnionTypes, $this->checkExplicitMixed, false, $this->checkBenevolentUnionTypes, true))); + return new ReturnTypeRule(new FunctionReturnTypeCheck(new RuleLevelHelper(self::createReflectionProvider(), true, false, $this->checkUnionTypes, $this->checkExplicitMixed, false, $this->checkBenevolentUnionTypes, true))); } public function testReturnTypeRule(): void @@ -572,7 +572,7 @@ public function testTemplateUnion(): void ]); } - public function dataBug5218(): array + public static function dataBug5218(): array { return [ [ diff --git a/tests/PHPStan/Rules/Methods/StaticMethodCallableRuleTest.php b/tests/PHPStan/Rules/Methods/StaticMethodCallableRuleTest.php index 8f3161de63..0afd0f7f0f 100644 --- a/tests/PHPStan/Rules/Methods/StaticMethodCallableRuleTest.php +++ b/tests/PHPStan/Rules/Methods/StaticMethodCallableRuleTest.php @@ -21,7 +21,7 @@ class StaticMethodCallableRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $ruleLevelHelper = new RuleLevelHelper($reflectionProvider, true, false, true, false, false, false, true); return new StaticMethodCallableRule( diff --git a/tests/PHPStan/Rules/Missing/MissingReturnRuleTest.php b/tests/PHPStan/Rules/Missing/MissingReturnRuleTest.php index 23bb2c73cb..08d9571499 100644 --- a/tests/PHPStan/Rules/Missing/MissingReturnRuleTest.php +++ b/tests/PHPStan/Rules/Missing/MissingReturnRuleTest.php @@ -171,7 +171,7 @@ public function testBug3669(): void $this->analyse([__DIR__ . '/data/bug-3669.php'], []); } - public function dataCheckPhpDocMissingReturn(): array + public static function dataCheckPhpDocMissingReturn(): array { return [ [ @@ -274,7 +274,7 @@ public function testCheckPhpDocMissingReturn(bool $checkPhpDocMissingReturn, arr $this->analyse([__DIR__ . '/data/check-phpdoc-missing-return.php'], $errors); } - public function dataModelMixin(): array + public static function dataModelMixin(): array { return [ [ diff --git a/tests/PHPStan/Rules/Namespaces/ExistingNamesInGroupUseRuleTest.php b/tests/PHPStan/Rules/Namespaces/ExistingNamesInGroupUseRuleTest.php index c49f6209f1..470da7e107 100644 --- a/tests/PHPStan/Rules/Namespaces/ExistingNamesInGroupUseRuleTest.php +++ b/tests/PHPStan/Rules/Namespaces/ExistingNamesInGroupUseRuleTest.php @@ -16,7 +16,7 @@ class ExistingNamesInGroupUseRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingNamesInGroupUseRule( $reflectionProvider, new ClassNameCheck( diff --git a/tests/PHPStan/Rules/Namespaces/ExistingNamesInUseRuleTest.php b/tests/PHPStan/Rules/Namespaces/ExistingNamesInUseRuleTest.php index 13fa5a254b..e78cd77e65 100644 --- a/tests/PHPStan/Rules/Namespaces/ExistingNamesInUseRuleTest.php +++ b/tests/PHPStan/Rules/Namespaces/ExistingNamesInUseRuleTest.php @@ -16,7 +16,7 @@ class ExistingNamesInUseRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingNamesInUseRule( $reflectionProvider, new ClassNameCheck( diff --git a/tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php b/tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php index cc27629dcf..068b4c84e3 100644 --- a/tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php +++ b/tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php @@ -23,7 +23,7 @@ protected function getRule(): Rule { return new InvalidBinaryOperationRule( new ExprPrinter(new Printer()), - new RuleLevelHelper($this->createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true), + new RuleLevelHelper(self::createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true), ); } diff --git a/tests/PHPStan/Rules/Operators/InvalidComparisonOperationRuleTest.php b/tests/PHPStan/Rules/Operators/InvalidComparisonOperationRuleTest.php index 3305d725c4..d91141d5e6 100644 --- a/tests/PHPStan/Rules/Operators/InvalidComparisonOperationRuleTest.php +++ b/tests/PHPStan/Rules/Operators/InvalidComparisonOperationRuleTest.php @@ -16,7 +16,7 @@ class InvalidComparisonOperationRuleTest extends RuleTestCase protected function getRule(): Rule { return new InvalidComparisonOperationRule( - new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true), + new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true), ); } diff --git a/tests/PHPStan/Rules/Operators/InvalidIncDecOperationRuleTest.php b/tests/PHPStan/Rules/Operators/InvalidIncDecOperationRuleTest.php index 63a9630c09..99be7a4e32 100644 --- a/tests/PHPStan/Rules/Operators/InvalidIncDecOperationRuleTest.php +++ b/tests/PHPStan/Rules/Operators/InvalidIncDecOperationRuleTest.php @@ -20,7 +20,7 @@ class InvalidIncDecOperationRuleTest extends RuleTestCase protected function getRule(): Rule { return new InvalidIncDecOperationRule( - new RuleLevelHelper($this->createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true), + new RuleLevelHelper(self::createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true), ); } diff --git a/tests/PHPStan/Rules/Operators/InvalidUnaryOperationRuleTest.php b/tests/PHPStan/Rules/Operators/InvalidUnaryOperationRuleTest.php index 5b1b47c41e..009bc167d0 100644 --- a/tests/PHPStan/Rules/Operators/InvalidUnaryOperationRuleTest.php +++ b/tests/PHPStan/Rules/Operators/InvalidUnaryOperationRuleTest.php @@ -20,7 +20,7 @@ class InvalidUnaryOperationRuleTest extends RuleTestCase protected function getRule(): Rule { return new InvalidUnaryOperationRule( - new RuleLevelHelper($this->createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true), + new RuleLevelHelper(self::createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true), ); } diff --git a/tests/PHPStan/Rules/PhpDoc/FunctionAssertRuleTest.php b/tests/PHPStan/Rules/PhpDoc/FunctionAssertRuleTest.php index 2bc6ddba35..c16a607dc1 100644 --- a/tests/PHPStan/Rules/PhpDoc/FunctionAssertRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/FunctionAssertRuleTest.php @@ -20,7 +20,7 @@ class FunctionAssertRuleTest extends RuleTestCase protected function getRule(): Rule { $initializerExprTypeResolver = self::getContainer()->getByType(InitializerExprTypeResolver::class); - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new FunctionAssertRule(new AssertRuleHelper( $initializerExprTypeResolver, $reflectionProvider, diff --git a/tests/PHPStan/Rules/PhpDoc/IncompatiblePhpDocTypeRuleTest.php b/tests/PHPStan/Rules/PhpDoc/IncompatiblePhpDocTypeRuleTest.php index b5ed921568..57df9d3f7f 100644 --- a/tests/PHPStan/Rules/PhpDoc/IncompatiblePhpDocTypeRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/IncompatiblePhpDocTypeRuleTest.php @@ -20,7 +20,7 @@ class IncompatiblePhpDocTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $typeAliasResolver = $this->createTypeAliasResolver(['TypeAlias' => 'int'], $reflectionProvider); return new IncompatiblePhpDocTypeRule( diff --git a/tests/PHPStan/Rules/PhpDoc/IncompatiblePropertyHookPhpDocTypeRuleTest.php b/tests/PHPStan/Rules/PhpDoc/IncompatiblePropertyHookPhpDocTypeRuleTest.php index e10eff3ff1..a28fe86d32 100644 --- a/tests/PHPStan/Rules/PhpDoc/IncompatiblePropertyHookPhpDocTypeRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/IncompatiblePropertyHookPhpDocTypeRuleTest.php @@ -20,7 +20,7 @@ class IncompatiblePropertyHookPhpDocTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $typeAliasResolver = $this->createTypeAliasResolver([], $reflectionProvider); return new IncompatiblePropertyHookPhpDocTypeRule( diff --git a/tests/PHPStan/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRuleTest.php b/tests/PHPStan/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRuleTest.php index b0ed51d449..c252fa002b 100644 --- a/tests/PHPStan/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRuleTest.php @@ -18,7 +18,7 @@ class IncompatiblePropertyPhpDocTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $typeAliasResolver = $this->createTypeAliasResolver(['TypeAlias' => 'int'], $reflectionProvider); return new IncompatiblePropertyPhpDocTypeRule( diff --git a/tests/PHPStan/Rules/PhpDoc/InvalidPhpDocVarTagTypeRuleTest.php b/tests/PHPStan/Rules/PhpDoc/InvalidPhpDocVarTagTypeRuleTest.php index ec26814c8f..e7a54bfc77 100644 --- a/tests/PHPStan/Rules/PhpDoc/InvalidPhpDocVarTagTypeRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/InvalidPhpDocVarTagTypeRuleTest.php @@ -20,7 +20,7 @@ class InvalidPhpDocVarTagTypeRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new InvalidPhpDocVarTagTypeRule( self::getContainer()->getByType(FileTypeMapper::class), $reflectionProvider, diff --git a/tests/PHPStan/Rules/PhpDoc/InvalidThrowsPhpDocValueRuleTest.php b/tests/PHPStan/Rules/PhpDoc/InvalidThrowsPhpDocValueRuleTest.php index e378f873b6..acfcb569a9 100644 --- a/tests/PHPStan/Rules/PhpDoc/InvalidThrowsPhpDocValueRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/InvalidThrowsPhpDocValueRuleTest.php @@ -100,7 +100,7 @@ public function testThrowsWithRequireExtends(): void ]); } - public function dataMergeInheritedPhpDocs(): array + public static function dataMergeInheritedPhpDocs(): array { return [ [ @@ -130,7 +130,7 @@ public function testMergeInheritedPhpDocs( string $expectedType, ): void { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $reflection = $reflectionProvider->getClass($className); $method = $reflection->getNativeMethod($method); $throwsType = $method->getThrowType(); diff --git a/tests/PHPStan/Rules/PhpDoc/MethodAssertRuleTest.php b/tests/PHPStan/Rules/PhpDoc/MethodAssertRuleTest.php index 99005c23bf..4341b7754e 100644 --- a/tests/PHPStan/Rules/PhpDoc/MethodAssertRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/MethodAssertRuleTest.php @@ -20,7 +20,7 @@ class MethodAssertRuleTest extends RuleTestCase protected function getRule(): Rule { $initializerExprTypeResolver = self::getContainer()->getByType(InitializerExprTypeResolver::class); - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new MethodAssertRule(new AssertRuleHelper( $initializerExprTypeResolver, $reflectionProvider, diff --git a/tests/PHPStan/Rules/PhpDoc/RequireExtendsDefinitionClassRuleTest.php b/tests/PHPStan/Rules/PhpDoc/RequireExtendsDefinitionClassRuleTest.php index 68e2bfd718..9eeae901a9 100644 --- a/tests/PHPStan/Rules/PhpDoc/RequireExtendsDefinitionClassRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/RequireExtendsDefinitionClassRuleTest.php @@ -17,7 +17,7 @@ class RequireExtendsDefinitionClassRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new RequireExtendsDefinitionClassRule( new RequireExtendsCheck( diff --git a/tests/PHPStan/Rules/PhpDoc/RequireExtendsDefinitionTraitRuleTest.php b/tests/PHPStan/Rules/PhpDoc/RequireExtendsDefinitionTraitRuleTest.php index 96f423723c..9065530f89 100644 --- a/tests/PHPStan/Rules/PhpDoc/RequireExtendsDefinitionTraitRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/RequireExtendsDefinitionTraitRuleTest.php @@ -17,7 +17,7 @@ class RequireExtendsDefinitionTraitRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new RequireExtendsDefinitionTraitRule( $reflectionProvider, diff --git a/tests/PHPStan/Rules/PhpDoc/RequireImplementsDefinitionTraitRuleTest.php b/tests/PHPStan/Rules/PhpDoc/RequireImplementsDefinitionTraitRuleTest.php index 4104983d3f..300947337a 100644 --- a/tests/PHPStan/Rules/PhpDoc/RequireImplementsDefinitionTraitRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/RequireImplementsDefinitionTraitRuleTest.php @@ -17,7 +17,7 @@ class RequireImplementsDefinitionTraitRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new RequireImplementsDefinitionTraitRule( $reflectionProvider, diff --git a/tests/PHPStan/Rules/PhpDoc/VarTagChangedExpressionTypeRuleTest.php b/tests/PHPStan/Rules/PhpDoc/VarTagChangedExpressionTypeRuleTest.php index d9307d0bc7..d515b2c8af 100644 --- a/tests/PHPStan/Rules/PhpDoc/VarTagChangedExpressionTypeRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/VarTagChangedExpressionTypeRuleTest.php @@ -18,7 +18,7 @@ protected function getRule(): Rule return new VarTagChangedExpressionTypeRule(new VarTagTypeRuleHelper( self::getContainer()->getByType(TypeNodeResolver::class), self::getContainer()->getByType(FileTypeMapper::class), - $this->createReflectionProvider(), + self::createReflectionProvider(), true, true, )); diff --git a/tests/PHPStan/Rules/PhpDoc/WrongVariableNameInVarTagRuleTest.php b/tests/PHPStan/Rules/PhpDoc/WrongVariableNameInVarTagRuleTest.php index ea87452e90..219ebc1bc5 100644 --- a/tests/PHPStan/Rules/PhpDoc/WrongVariableNameInVarTagRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/WrongVariableNameInVarTagRuleTest.php @@ -25,7 +25,7 @@ protected function getRule(): Rule new VarTagTypeRuleHelper( self::getContainer()->getByType(TypeNodeResolver::class), self::getContainer()->getByType(FileTypeMapper::class), - $this->createReflectionProvider(), + self::createReflectionProvider(), $this->checkTypeAgainstPhpDocType, $this->strictWideningCheck, ), @@ -249,7 +249,7 @@ public function testEnums(): void ]); } - public function dataReportWrongType(): iterable + public static function dataReportWrongType(): iterable { $nativeCheckOnly = [ [ @@ -530,7 +530,7 @@ public function testEmptyArrayInitWithWiderPhpDoc(bool $checkTypeAgainstPhpDocTy ]); } - public function dataPermutateCheckTypeAgainst(): iterable + public static function dataPermutateCheckTypeAgainst(): iterable { yield [true]; yield [false]; diff --git a/tests/PHPStan/Rules/Properties/AccessPropertiesInAssignRuleTest.php b/tests/PHPStan/Rules/Properties/AccessPropertiesInAssignRuleTest.php index 0640efd885..55f6f3bb11 100644 --- a/tests/PHPStan/Rules/Properties/AccessPropertiesInAssignRuleTest.php +++ b/tests/PHPStan/Rules/Properties/AccessPropertiesInAssignRuleTest.php @@ -16,7 +16,7 @@ class AccessPropertiesInAssignRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new AccessPropertiesInAssignRule( new AccessPropertiesCheck($reflectionProvider, new RuleLevelHelper($reflectionProvider, true, false, true, false, false, false, true), new PhpVersion(PHP_VERSION_ID), true, true), ); diff --git a/tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php b/tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php index 3fab4606d8..d8e9f33ac3 100644 --- a/tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php @@ -23,7 +23,7 @@ class AccessPropertiesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new AccessPropertiesRule(new AccessPropertiesCheck($reflectionProvider, new RuleLevelHelper($reflectionProvider, true, $this->checkThisOnly, $this->checkUnionTypes, false, false, false, true), new PhpVersion(PHP_VERSION_ID), true, $this->checkDynamicProperties)); } @@ -639,7 +639,7 @@ public function testBug3659(): void $this->analyse([__DIR__ . '/data/bug-3659.php'], $errors); } - public function dataDynamicProperties(): array + public static function dataDynamicProperties(): array { $tipText = 'Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property'; $errors = [ @@ -807,7 +807,7 @@ public function testBug3171OnDynamicProperties(): void $this->analyse([__DIR__ . '/data/bug-3171.php'], []); } - public function dataTrueAndFalse(): array + public static function dataTrueAndFalse(): array { return [ [true], diff --git a/tests/PHPStan/Rules/Properties/AccessStaticPropertiesInAssignRuleTest.php b/tests/PHPStan/Rules/Properties/AccessStaticPropertiesInAssignRuleTest.php index 355cf0dfa2..01b3133fa6 100644 --- a/tests/PHPStan/Rules/Properties/AccessStaticPropertiesInAssignRuleTest.php +++ b/tests/PHPStan/Rules/Properties/AccessStaticPropertiesInAssignRuleTest.php @@ -17,7 +17,7 @@ class AccessStaticPropertiesInAssignRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new AccessStaticPropertiesInAssignRule( new AccessStaticPropertiesRule( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Properties/AccessStaticPropertiesRuleTest.php b/tests/PHPStan/Rules/Properties/AccessStaticPropertiesRuleTest.php index bae249fd95..deba1aeb7c 100644 --- a/tests/PHPStan/Rules/Properties/AccessStaticPropertiesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/AccessStaticPropertiesRuleTest.php @@ -17,7 +17,7 @@ class AccessStaticPropertiesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new AccessStaticPropertiesRule( $reflectionProvider, new RuleLevelHelper($reflectionProvider, true, false, true, false, false, false, true), diff --git a/tests/PHPStan/Rules/Properties/Bug7074Test.php b/tests/PHPStan/Rules/Properties/Bug7074Test.php index 55df196d56..8e1ef0c3e0 100644 --- a/tests/PHPStan/Rules/Properties/Bug7074Test.php +++ b/tests/PHPStan/Rules/Properties/Bug7074Test.php @@ -15,7 +15,7 @@ class Bug7074Test extends RuleTestCase protected function getRule(): Rule { - return new DefaultValueTypesAssignedToPropertiesRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true)); + return new DefaultValueTypesAssignedToPropertiesRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true)); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Properties/DefaultValueTypesAssignedToPropertiesRuleTest.php b/tests/PHPStan/Rules/Properties/DefaultValueTypesAssignedToPropertiesRuleTest.php index ad1a9b43a9..1bc6512618 100644 --- a/tests/PHPStan/Rules/Properties/DefaultValueTypesAssignedToPropertiesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/DefaultValueTypesAssignedToPropertiesRuleTest.php @@ -14,7 +14,7 @@ class DefaultValueTypesAssignedToPropertiesRuleTest extends RuleTestCase protected function getRule(): Rule { - return new DefaultValueTypesAssignedToPropertiesRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true)); + return new DefaultValueTypesAssignedToPropertiesRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true)); } public function testDefaultValueTypesAssignedToProperties(): void diff --git a/tests/PHPStan/Rules/Properties/ExistingClassesInPropertiesRuleTest.php b/tests/PHPStan/Rules/Properties/ExistingClassesInPropertiesRuleTest.php index 873654f585..4c1b97c45a 100644 --- a/tests/PHPStan/Rules/Properties/ExistingClassesInPropertiesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/ExistingClassesInPropertiesRuleTest.php @@ -21,7 +21,7 @@ class ExistingClassesInPropertiesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassesInPropertiesRule( $reflectionProvider, new ClassNameCheck( @@ -146,7 +146,7 @@ public function testPromotedProperties(): void ]); } - public function dataIntersectionTypes(): array + public static function dataIntersectionTypes(): array { return [ [80000, []], diff --git a/tests/PHPStan/Rules/Properties/ExistingClassesInPropertyHookTypehintsRuleTest.php b/tests/PHPStan/Rules/Properties/ExistingClassesInPropertyHookTypehintsRuleTest.php index ddb533c25f..da7c43d985 100644 --- a/tests/PHPStan/Rules/Properties/ExistingClassesInPropertyHookTypehintsRuleTest.php +++ b/tests/PHPStan/Rules/Properties/ExistingClassesInPropertyHookTypehintsRuleTest.php @@ -20,7 +20,7 @@ class ExistingClassesInPropertyHookTypehintsRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new ExistingClassesInPropertyHookTypehintsRule( new FunctionDefinitionCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Properties/OverridingPropertyRuleTest.php b/tests/PHPStan/Rules/Properties/OverridingPropertyRuleTest.php index dd9749e079..5aec8932fb 100644 --- a/tests/PHPStan/Rules/Properties/OverridingPropertyRuleTest.php +++ b/tests/PHPStan/Rules/Properties/OverridingPropertyRuleTest.php @@ -104,7 +104,7 @@ public function testRule(): void ]); } - public function dataRulePHPDocTypes(): array + public static function dataRulePHPDocTypes(): array { $tip = sprintf( "You can fix 3rd party PHPDoc types with stub files:\n %s", diff --git a/tests/PHPStan/Rules/Properties/PropertyAttributesRuleTest.php b/tests/PHPStan/Rules/Properties/PropertyAttributesRuleTest.php index 00874ab151..e5eab80521 100644 --- a/tests/PHPStan/Rules/Properties/PropertyAttributesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/PropertyAttributesRuleTest.php @@ -21,7 +21,7 @@ class PropertyAttributesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new PropertyAttributesRule( new AttributesCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Properties/PropertyHookAttributesRuleTest.php b/tests/PHPStan/Rules/Properties/PropertyHookAttributesRuleTest.php index 7a0e80e653..382f43f18d 100644 --- a/tests/PHPStan/Rules/Properties/PropertyHookAttributesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/PropertyHookAttributesRuleTest.php @@ -22,7 +22,7 @@ class PropertyHookAttributesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new PropertyHookAttributesRule( new AttributesCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Properties/ReadOnlyPropertyRuleTest.php b/tests/PHPStan/Rules/Properties/ReadOnlyPropertyRuleTest.php index 30f9606744..fd218d8ea3 100644 --- a/tests/PHPStan/Rules/Properties/ReadOnlyPropertyRuleTest.php +++ b/tests/PHPStan/Rules/Properties/ReadOnlyPropertyRuleTest.php @@ -19,7 +19,7 @@ protected function getRule(): Rule return new ReadOnlyPropertyRule(new PhpVersion($this->phpVersionId)); } - public function dataRule(): array + public static function dataRule(): array { return [ [ diff --git a/tests/PHPStan/Rules/Properties/ReadingWriteOnlyPropertiesRuleTest.php b/tests/PHPStan/Rules/Properties/ReadingWriteOnlyPropertiesRuleTest.php index 83c919af1f..e06990b5a7 100644 --- a/tests/PHPStan/Rules/Properties/ReadingWriteOnlyPropertiesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/ReadingWriteOnlyPropertiesRuleTest.php @@ -17,7 +17,7 @@ class ReadingWriteOnlyPropertiesRuleTest extends RuleTestCase protected function getRule(): Rule { - return new ReadingWriteOnlyPropertiesRule(new PropertyDescriptor(), new PropertyReflectionFinder(), new RuleLevelHelper($this->createReflectionProvider(), true, $this->checkThisOnly, true, false, false, false, true), $this->checkThisOnly); + return new ReadingWriteOnlyPropertiesRule(new PropertyDescriptor(), new PropertyReflectionFinder(), new RuleLevelHelper(self::createReflectionProvider(), true, $this->checkThisOnly, true, false, false, false, true), $this->checkThisOnly); } public function testPropertyMustBeReadableInAssignOp(): void diff --git a/tests/PHPStan/Rules/Properties/TypesAssignedToPropertiesRuleTest.php b/tests/PHPStan/Rules/Properties/TypesAssignedToPropertiesRuleTest.php index 4260da643c..fcd1599c88 100644 --- a/tests/PHPStan/Rules/Properties/TypesAssignedToPropertiesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/TypesAssignedToPropertiesRuleTest.php @@ -19,7 +19,7 @@ class TypesAssignedToPropertiesRuleTest extends RuleTestCase protected function getRule(): Rule { - return new TypesAssignedToPropertiesRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true), new PropertyReflectionFinder()); + return new TypesAssignedToPropertiesRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, $this->checkExplicitMixed, $this->checkImplicitMixed, false, true), new PropertyReflectionFinder()); } public function testTypesAssignedToProperties(): void diff --git a/tests/PHPStan/Rules/Properties/WritingToReadOnlyPropertiesRuleTest.php b/tests/PHPStan/Rules/Properties/WritingToReadOnlyPropertiesRuleTest.php index b11e08f127..39e81fe08a 100644 --- a/tests/PHPStan/Rules/Properties/WritingToReadOnlyPropertiesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/WritingToReadOnlyPropertiesRuleTest.php @@ -17,7 +17,7 @@ class WritingToReadOnlyPropertiesRuleTest extends RuleTestCase protected function getRule(): Rule { - return new WritingToReadOnlyPropertiesRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true), new PropertyDescriptor(), new PropertyReflectionFinder(), $this->checkThisOnly); + return new WritingToReadOnlyPropertiesRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true), new PropertyDescriptor(), new PropertyReflectionFinder(), $this->checkThisOnly); } public function testCheckThisOnlyProperties(): void diff --git a/tests/PHPStan/Rules/Pure/PureMethodRuleTest.php b/tests/PHPStan/Rules/Pure/PureMethodRuleTest.php index c31874629d..fc573151e5 100644 --- a/tests/PHPStan/Rules/Pure/PureMethodRuleTest.php +++ b/tests/PHPStan/Rules/Pure/PureMethodRuleTest.php @@ -198,7 +198,7 @@ public function testBug11207(bool $treatPhpDocTypesAsCertain): void $this->analyse([__DIR__ . '/data/bug-11207.php'], []); } - public function dataBug11207(): array + public static function dataBug11207(): array { return [ [true], diff --git a/tests/PHPStan/Rules/Regexp/RegularExpressionPatternRuleTest.php b/tests/PHPStan/Rules/Regexp/RegularExpressionPatternRuleTest.php index 99f777b2ff..6c94e6d96e 100644 --- a/tests/PHPStan/Rules/Regexp/RegularExpressionPatternRuleTest.php +++ b/tests/PHPStan/Rules/Regexp/RegularExpressionPatternRuleTest.php @@ -162,7 +162,7 @@ public function testArrayShapePatterns(string $file, array $errors): void ); } - public function dataArrayShapePatterns(): iterable + public static function dataArrayShapePatterns(): iterable { yield [ __DIR__ . '/../../Analyser/nsrt/preg_match_all_shapes.php', diff --git a/tests/PHPStan/Rules/Regexp/RegularExpressionQuotingRuleTest.php b/tests/PHPStan/Rules/Regexp/RegularExpressionQuotingRuleTest.php index 38197c1aa6..a74a1a34e4 100644 --- a/tests/PHPStan/Rules/Regexp/RegularExpressionQuotingRuleTest.php +++ b/tests/PHPStan/Rules/Regexp/RegularExpressionQuotingRuleTest.php @@ -16,7 +16,7 @@ class RegularExpressionQuotingRuleTest extends RuleTestCase protected function getRule(): Rule { return new RegularExpressionQuotingRule( - $this->createReflectionProvider(), + self::createReflectionProvider(), self::getContainer()->getByType(RegexExpressionHelper::class), ); } diff --git a/tests/PHPStan/Rules/RestrictedUsage/RestrictedClassConstantUsageRuleTest.php b/tests/PHPStan/Rules/RestrictedUsage/RestrictedClassConstantUsageRuleTest.php index cd24bbb3be..5bbb53b83d 100644 --- a/tests/PHPStan/Rules/RestrictedUsage/RestrictedClassConstantUsageRuleTest.php +++ b/tests/PHPStan/Rules/RestrictedUsage/RestrictedClassConstantUsageRuleTest.php @@ -14,7 +14,7 @@ class RestrictedClassConstantUsageRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new RestrictedClassConstantUsageRule( self::getContainer(), $reflectionProvider, diff --git a/tests/PHPStan/Rules/RestrictedUsage/RestrictedFunctionCallableUsageRuleTest.php b/tests/PHPStan/Rules/RestrictedUsage/RestrictedFunctionCallableUsageRuleTest.php index d3ca0c99a3..49a23ac859 100644 --- a/tests/PHPStan/Rules/RestrictedUsage/RestrictedFunctionCallableUsageRuleTest.php +++ b/tests/PHPStan/Rules/RestrictedUsage/RestrictedFunctionCallableUsageRuleTest.php @@ -16,7 +16,7 @@ protected function getRule(): Rule { return new RestrictedFunctionCallableUsageRule( self::getContainer(), - $this->createReflectionProvider(), + self::createReflectionProvider(), ); } diff --git a/tests/PHPStan/Rules/RestrictedUsage/RestrictedFunctionUsageRuleTest.php b/tests/PHPStan/Rules/RestrictedUsage/RestrictedFunctionUsageRuleTest.php index 7bab882e70..d96412eab9 100644 --- a/tests/PHPStan/Rules/RestrictedUsage/RestrictedFunctionUsageRuleTest.php +++ b/tests/PHPStan/Rules/RestrictedUsage/RestrictedFunctionUsageRuleTest.php @@ -15,7 +15,7 @@ protected function getRule(): Rule { return new RestrictedFunctionUsageRule( self::getContainer(), - $this->createReflectionProvider(), + self::createReflectionProvider(), ); } diff --git a/tests/PHPStan/Rules/RestrictedUsage/RestrictedMethodCallableUsageRuleTest.php b/tests/PHPStan/Rules/RestrictedUsage/RestrictedMethodCallableUsageRuleTest.php index c5de137c29..1d141b0eff 100644 --- a/tests/PHPStan/Rules/RestrictedUsage/RestrictedMethodCallableUsageRuleTest.php +++ b/tests/PHPStan/Rules/RestrictedUsage/RestrictedMethodCallableUsageRuleTest.php @@ -16,7 +16,7 @@ protected function getRule(): TRule { return new RestrictedMethodCallableUsageRule( self::getContainer(), - $this->createReflectionProvider(), + self::createReflectionProvider(), ); } diff --git a/tests/PHPStan/Rules/RestrictedUsage/RestrictedMethodUsageRuleTest.php b/tests/PHPStan/Rules/RestrictedUsage/RestrictedMethodUsageRuleTest.php index fd88cbd72b..dd7aac599a 100644 --- a/tests/PHPStan/Rules/RestrictedUsage/RestrictedMethodUsageRuleTest.php +++ b/tests/PHPStan/Rules/RestrictedUsage/RestrictedMethodUsageRuleTest.php @@ -15,7 +15,7 @@ protected function getRule(): TRule { return new RestrictedMethodUsageRule( self::getContainer(), - $this->createReflectionProvider(), + self::createReflectionProvider(), ); } diff --git a/tests/PHPStan/Rules/RestrictedUsage/RestrictedPropertyUsageRuleTest.php b/tests/PHPStan/Rules/RestrictedUsage/RestrictedPropertyUsageRuleTest.php index 177a5d3414..2fd50f13ad 100644 --- a/tests/PHPStan/Rules/RestrictedUsage/RestrictedPropertyUsageRuleTest.php +++ b/tests/PHPStan/Rules/RestrictedUsage/RestrictedPropertyUsageRuleTest.php @@ -15,7 +15,7 @@ protected function getRule(): TRule { return new RestrictedPropertyUsageRule( self::getContainer(), - $this->createReflectionProvider(), + self::createReflectionProvider(), ); } diff --git a/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticMethodCallableUsageRuleTest.php b/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticMethodCallableUsageRuleTest.php index f5b2e6934f..d0c31e1cbe 100644 --- a/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticMethodCallableUsageRuleTest.php +++ b/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticMethodCallableUsageRuleTest.php @@ -15,7 +15,7 @@ class RestrictedStaticMethodCallableUsageRuleTest extends RuleTestCase protected function getRule(): TRule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new RestrictedStaticMethodCallableUsageRule( self::getContainer(), $reflectionProvider, diff --git a/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticMethodUsageRuleTest.php b/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticMethodUsageRuleTest.php index 9811979744..9aed48d97b 100644 --- a/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticMethodUsageRuleTest.php +++ b/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticMethodUsageRuleTest.php @@ -15,7 +15,7 @@ class RestrictedStaticMethodUsageRuleTest extends RuleTestCase protected function getRule(): TRule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new RestrictedStaticMethodUsageRule( self::getContainer(), $reflectionProvider, diff --git a/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticPropertyUsageRuleTest.php b/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticPropertyUsageRuleTest.php index 267f5dd531..985fc5d779 100644 --- a/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticPropertyUsageRuleTest.php +++ b/tests/PHPStan/Rules/RestrictedUsage/RestrictedStaticPropertyUsageRuleTest.php @@ -14,7 +14,7 @@ class RestrictedStaticPropertyUsageRuleTest extends RuleTestCase protected function getRule(): TRule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new RestrictedStaticPropertyUsageRule( self::getContainer(), $reflectionProvider, diff --git a/tests/PHPStan/Rules/RestrictedUsage/RestrictedUsageOfDeprecatedStringCastRuleTest.php b/tests/PHPStan/Rules/RestrictedUsage/RestrictedUsageOfDeprecatedStringCastRuleTest.php index 6db182b4f5..660acdad20 100644 --- a/tests/PHPStan/Rules/RestrictedUsage/RestrictedUsageOfDeprecatedStringCastRuleTest.php +++ b/tests/PHPStan/Rules/RestrictedUsage/RestrictedUsageOfDeprecatedStringCastRuleTest.php @@ -15,7 +15,7 @@ protected function getRule(): Rule { return new RestrictedUsageOfDeprecatedStringCastRule( self::getContainer(), - $this->createReflectionProvider(), + self::createReflectionProvider(), ); } diff --git a/tests/PHPStan/Rules/TooWideTypehints/TooWideMethodReturnTypehintRuleTest.php b/tests/PHPStan/Rules/TooWideTypehints/TooWideMethodReturnTypehintRuleTest.php index a98c638d24..333ecb1c8c 100644 --- a/tests/PHPStan/Rules/TooWideTypehints/TooWideMethodReturnTypehintRuleTest.php +++ b/tests/PHPStan/Rules/TooWideTypehints/TooWideMethodReturnTypehintRuleTest.php @@ -108,7 +108,7 @@ public function testBug6175(): void $this->analyse([__DIR__ . '/data/bug-6175.php'], []); } - public function dataAlwaysCheckFinal(): iterable + public static function dataAlwaysCheckFinal(): iterable { yield [ false, diff --git a/tests/PHPStan/Rules/Traits/ConflictingTraitConstantsRuleTest.php b/tests/PHPStan/Rules/Traits/ConflictingTraitConstantsRuleTest.php index c3b06e73d0..9515e5dd11 100644 --- a/tests/PHPStan/Rules/Traits/ConflictingTraitConstantsRuleTest.php +++ b/tests/PHPStan/Rules/Traits/ConflictingTraitConstantsRuleTest.php @@ -14,7 +14,7 @@ class ConflictingTraitConstantsRuleTest extends RuleTestCase protected function getRule(): TRule { - return new ConflictingTraitConstantsRule(self::getContainer()->getByType(InitializerExprTypeResolver::class), $this->createReflectionProvider()); + return new ConflictingTraitConstantsRule(self::getContainer()->getByType(InitializerExprTypeResolver::class), self::createReflectionProvider()); } public function testRule(): void diff --git a/tests/PHPStan/Rules/Traits/ConstantsInTraitsRuleTest.php b/tests/PHPStan/Rules/Traits/ConstantsInTraitsRuleTest.php index 3b6f591527..2e1e37386c 100644 --- a/tests/PHPStan/Rules/Traits/ConstantsInTraitsRuleTest.php +++ b/tests/PHPStan/Rules/Traits/ConstantsInTraitsRuleTest.php @@ -20,7 +20,7 @@ protected function getRule(): Rule return new ConstantsInTraitsRule(new PhpVersion($this->phpVersionId)); } - public function dataRule(): array + public static function dataRule(): array { return [ [ diff --git a/tests/PHPStan/Rules/Traits/TraitAttributesRuleTest.php b/tests/PHPStan/Rules/Traits/TraitAttributesRuleTest.php index b4e2455cb8..b2f0268efd 100644 --- a/tests/PHPStan/Rules/Traits/TraitAttributesRuleTest.php +++ b/tests/PHPStan/Rules/Traits/TraitAttributesRuleTest.php @@ -27,7 +27,7 @@ class TraitAttributesRuleTest extends RuleTestCase protected function getRule(): Rule { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return new TraitAttributesRule( new AttributesCheck( $reflectionProvider, diff --git a/tests/PHPStan/Rules/Variables/DefinedVariableRuleTest.php b/tests/PHPStan/Rules/Variables/DefinedVariableRuleTest.php index 71ad7280c8..79789b59fa 100644 --- a/tests/PHPStan/Rules/Variables/DefinedVariableRuleTest.php +++ b/tests/PHPStan/Rules/Variables/DefinedVariableRuleTest.php @@ -313,7 +313,7 @@ public function testCliArgumentsVariablesRegistered(): void ]); } - public function dataLoopInitialAssignments(): array + public static function dataLoopInitialAssignments(): array { return [ [ @@ -462,7 +462,7 @@ public function testForeach(): void ]); } - public function dataForeachPolluteScopeWithAlwaysIterableForeach(): array + public static function dataForeachPolluteScopeWithAlwaysIterableForeach(): array { return [ [ diff --git a/tests/PHPStan/Rules/Variables/EmptyRuleTest.php b/tests/PHPStan/Rules/Variables/EmptyRuleTest.php index 178101b951..21372b778b 100644 --- a/tests/PHPStan/Rules/Variables/EmptyRuleTest.php +++ b/tests/PHPStan/Rules/Variables/EmptyRuleTest.php @@ -188,7 +188,7 @@ public function testBug9126(): void $this->analyse([__DIR__ . '/data/bug-9126.php'], []); } - public function dataBug9403(): iterable + public static function dataBug9403(): iterable { yield [true]; yield [false]; diff --git a/tests/PHPStan/Rules/Variables/ParameterOutAssignedTypeRuleTest.php b/tests/PHPStan/Rules/Variables/ParameterOutAssignedTypeRuleTest.php index 1e651b6b48..89ff299270 100644 --- a/tests/PHPStan/Rules/Variables/ParameterOutAssignedTypeRuleTest.php +++ b/tests/PHPStan/Rules/Variables/ParameterOutAssignedTypeRuleTest.php @@ -15,7 +15,7 @@ class ParameterOutAssignedTypeRuleTest extends RuleTestCase protected function getRule(): TRule { return new ParameterOutAssignedTypeRule( - new RuleLevelHelper($this->createReflectionProvider(), true, false, true, true, false, false, true), + new RuleLevelHelper(self::createReflectionProvider(), true, false, true, true, false, false, true), ); } diff --git a/tests/PHPStan/Rules/Variables/ParameterOutExecutionEndTypeRuleTest.php b/tests/PHPStan/Rules/Variables/ParameterOutExecutionEndTypeRuleTest.php index 5929aad03a..1eb577826d 100644 --- a/tests/PHPStan/Rules/Variables/ParameterOutExecutionEndTypeRuleTest.php +++ b/tests/PHPStan/Rules/Variables/ParameterOutExecutionEndTypeRuleTest.php @@ -15,7 +15,7 @@ class ParameterOutExecutionEndTypeRuleTest extends RuleTestCase protected function getRule(): Rule { return new ParameterOutExecutionEndTypeRule( - new RuleLevelHelper($this->createReflectionProvider(), true, false, true, true, false, false, true), + new RuleLevelHelper(self::createReflectionProvider(), true, false, true, true, false, false, true), ); } diff --git a/tests/PHPStan/Rules/Variables/VariableCloningRuleTest.php b/tests/PHPStan/Rules/Variables/VariableCloningRuleTest.php index d26101b421..869ff35c31 100644 --- a/tests/PHPStan/Rules/Variables/VariableCloningRuleTest.php +++ b/tests/PHPStan/Rules/Variables/VariableCloningRuleTest.php @@ -15,7 +15,7 @@ class VariableCloningRuleTest extends RuleTestCase protected function getRule(): Rule { - return new VariableCloningRule(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, false, true)); + return new VariableCloningRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true)); } public function testClone(): void diff --git a/tests/PHPStan/Testing/TypeInferenceTestCaseTest.php b/tests/PHPStan/Testing/TypeInferenceTestCaseTest.php index c8220a0e9a..5f363661a5 100644 --- a/tests/PHPStan/Testing/TypeInferenceTestCaseTest.php +++ b/tests/PHPStan/Testing/TypeInferenceTestCaseTest.php @@ -88,14 +88,14 @@ public function testFileAssertionFailedErrors(string $filePath, string $errorMes $this->expectException(AssertionFailedError::class); $this->expectExceptionMessage($errorMessage); - $this->gatherAssertTypes($filePath); + self::gatherAssertTypes($filePath); } public function testVariableOrOffsetDescription(): void { $filePath = __DIR__ . '/data/assert-certainty-variable-or-offset.php'; - [$variableAssert, $offsetAssert] = array_values($this->gatherAssertTypes($filePath)); + [$variableAssert, $offsetAssert] = array_values(self::gatherAssertTypes($filePath)); $this->assertSame('variable $context', $variableAssert[4]); $this->assertSame("offset 'email'", $offsetAssert[4]); @@ -103,7 +103,7 @@ public function testVariableOrOffsetDescription(): void public function testNonexistentClassInAnalysedFile(): void { - foreach ($this->gatherAssertTypes(__DIR__ . '/../../notAutoloaded/nonexistentClasses.php') as $data) { + foreach (self::gatherAssertTypes(__DIR__ . '/../../notAutoloaded/nonexistentClasses.php') as $data) { $this->assertFileAsserts(...$data); } } @@ -111,7 +111,7 @@ public function testNonexistentClassInAnalysedFile(): void public function testNonexistentClassInAnalysedFileWithError(): void { try { - foreach ($this->gatherAssertTypes(__DIR__ . '/../../notAutoloaded/nonexistentClasses-error.php') as $data) { + foreach (self::gatherAssertTypes(__DIR__ . '/../../notAutoloaded/nonexistentClasses-error.php') as $data) { $this->assertFileAsserts(...$data); } diff --git a/tests/PHPStan/TrinaryLogicTest.php b/tests/PHPStan/TrinaryLogicTest.php index c487e2d5c3..763f913f6b 100644 --- a/tests/PHPStan/TrinaryLogicTest.php +++ b/tests/PHPStan/TrinaryLogicTest.php @@ -7,7 +7,7 @@ class TrinaryLogicTest extends PHPStanTestCase { - public function dataAnd(): array + public static function dataAnd(): array { return [ [TrinaryLogic::createNo(), TrinaryLogic::createNo()], @@ -52,7 +52,7 @@ public function testLazyAnd( $this->assertTrue($expectedResult->equals($value->lazyAnd($operands, static fn (TrinaryLogic $result) => $result))); } - public function dataOr(): array + public static function dataOr(): array { return [ [TrinaryLogic::createNo(), TrinaryLogic::createNo()], @@ -97,7 +97,7 @@ public function testLazyOr( $this->assertTrue($expectedResult->equals($value->lazyOr($operands, static fn (TrinaryLogic $result) => $result))); } - public function dataNegate(): array + public static function dataNegate(): array { return [ [TrinaryLogic::createNo(), TrinaryLogic::createYes()], @@ -114,7 +114,7 @@ public function testNegate(TrinaryLogic $expectedResult, TrinaryLogic $operand): $this->assertTrue($expectedResult->equals($operand->negate())); } - public function dataCompareTo(): array + public static function dataCompareTo(): array { $yes = TrinaryLogic::createYes(); $maybe = TrinaryLogic::createMaybe(); diff --git a/tests/PHPStan/Type/Accessory/HasMethodTypeTest.php b/tests/PHPStan/Type/Accessory/HasMethodTypeTest.php index a941dd86ee..f5314e378d 100644 --- a/tests/PHPStan/Type/Accessory/HasMethodTypeTest.php +++ b/tests/PHPStan/Type/Accessory/HasMethodTypeTest.php @@ -22,7 +22,7 @@ class HasMethodTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { return [ [ @@ -149,7 +149,7 @@ public function testIsSuperTypeOf(HasMethodType $type, Type $otherType, TrinaryL ); } - public function dataIsSubTypeOf(): array + public static function dataIsSubTypeOf(): array { return [ [ diff --git a/tests/PHPStan/Type/Accessory/HasPropertyTypeTest.php b/tests/PHPStan/Type/Accessory/HasPropertyTypeTest.php index 4cecca14c1..e9cb484e42 100644 --- a/tests/PHPStan/Type/Accessory/HasPropertyTypeTest.php +++ b/tests/PHPStan/Type/Accessory/HasPropertyTypeTest.php @@ -22,7 +22,7 @@ class HasPropertyTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { return [ [ @@ -115,7 +115,7 @@ public function testIsSuperTypeOf(HasPropertyType $type, Type $otherType, Trinar ); } - public function dataIsSubTypeOf(): array + public static function dataIsSubTypeOf(): array { return [ [ diff --git a/tests/PHPStan/Type/ArrayTypeTest.php b/tests/PHPStan/Type/ArrayTypeTest.php index fe02aeb58e..652504c2e2 100644 --- a/tests/PHPStan/Type/ArrayTypeTest.php +++ b/tests/PHPStan/Type/ArrayTypeTest.php @@ -18,7 +18,7 @@ class ArrayTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { return [ [ @@ -98,7 +98,7 @@ public function testIsSuperTypeOf(ArrayType $type, Type $otherType, TrinaryLogic ); } - public function dataAccepts(): array + public static function dataAccepts(): array { $reflectionProvider = ReflectionProviderStaticAccessor::getInstance(); @@ -164,7 +164,7 @@ public function testAccepts( ); } - public function dataDescribe(): array + public static function dataDescribe(): array { return [ [ @@ -188,7 +188,7 @@ public function testDescribe( $this->assertSame($expectedDescription, $type->describe(VerbosityLevel::precise())); } - public function dataInferTemplateTypes(): array + public static function dataInferTemplateTypes(): array { $templateType = static fn ($name): Type => TemplateTypeFactory::create( TemplateTypeScope::createWithFunction('a'), diff --git a/tests/PHPStan/Type/BenevolentUnionTypeTest.php b/tests/PHPStan/Type/BenevolentUnionTypeTest.php index 18a37f8be0..97aece38b0 100644 --- a/tests/PHPStan/Type/BenevolentUnionTypeTest.php +++ b/tests/PHPStan/Type/BenevolentUnionTypeTest.php @@ -19,7 +19,7 @@ class BenevolentUnionTypeTest extends PHPStanTestCase { - public function dataCanAccessProperties(): Iterator + public static function dataCanAccessProperties(): Iterator { yield [ new BenevolentUnionType([new ObjectWithoutClassType(), new ObjectWithoutClassType()]), @@ -48,7 +48,7 @@ public function testCanAccessProperties(BenevolentUnionType $type, TrinaryLogic ); } - public function dataHasProperty(): Iterator + public static function dataHasProperty(): Iterator { yield [ new BenevolentUnionType([ @@ -86,7 +86,7 @@ public function testHasProperty(BenevolentUnionType $type, string $propertyName, ); } - public function dataCanCallMethods(): Iterator + public static function dataCanCallMethods(): Iterator { yield [ new BenevolentUnionType([new ObjectWithoutClassType(), new ObjectWithoutClassType()]), @@ -115,7 +115,7 @@ public function testCanCanCallMethods(BenevolentUnionType $type, TrinaryLogic $e ); } - public function dataHasMethod(): Iterator + public static function dataHasMethod(): Iterator { yield [ new BenevolentUnionType([ @@ -150,7 +150,7 @@ public function testHasMethod(BenevolentUnionType $type, string $methodName, Tri ); } - public function dataCanAccessConstants(): Iterator + public static function dataCanAccessConstants(): Iterator { yield [ new BenevolentUnionType([new ObjectWithoutClassType(), new ObjectWithoutClassType()]), @@ -179,7 +179,7 @@ public function testCanAccessConstants(BenevolentUnionType $type, TrinaryLogic $ ); } - public function dataIsIterable(): Iterator + public static function dataIsIterable(): Iterator { yield [ new BenevolentUnionType([ @@ -214,7 +214,7 @@ public function testIsIterable(BenevolentUnionType $type, TrinaryLogic $expected ); } - public function dataIsIterableAtLeastOnce(): Iterator + public static function dataIsIterableAtLeastOnce(): Iterator { yield [ new BenevolentUnionType([ @@ -249,7 +249,7 @@ public function testIsIterableAtLeastOnce(BenevolentUnionType $type, TrinaryLogi ); } - public function dataIsArray(): Iterator + public static function dataIsArray(): Iterator { yield [ new BenevolentUnionType([new ArrayType(new MixedType(), new MixedType()), new ConstantArrayType([], [])]), @@ -278,7 +278,7 @@ public function testIsArray(BenevolentUnionType $type, TrinaryLogic $expectedRes ); } - public function dataIsString(): Iterator + public static function dataIsString(): Iterator { yield [ new BenevolentUnionType([ @@ -310,7 +310,7 @@ public function testIsString(BenevolentUnionType $type, TrinaryLogic $expectedRe ); } - public function dataIsNumericString(): Iterator + public static function dataIsNumericString(): Iterator { yield [ new BenevolentUnionType([ @@ -341,7 +341,7 @@ public function testIsNumericString(BenevolentUnionType $type, TrinaryLogic $exp ); } - public function dataIsNonFalsyString(): Iterator + public static function dataIsNonFalsyString(): Iterator { yield [ new BenevolentUnionType([ @@ -372,7 +372,7 @@ public function testIsNonFalsyString(BenevolentUnionType $type, TrinaryLogic $ex ); } - public function dataIsLiteralString(): Iterator + public static function dataIsLiteralString(): Iterator { yield [ new BenevolentUnionType([ @@ -403,7 +403,7 @@ public function testIsLiteralString(BenevolentUnionType $type, TrinaryLogic $exp ); } - public function dataIsOffsetAccesible(): Iterator + public static function dataIsOffsetAccesible(): Iterator { yield [ new BenevolentUnionType([ @@ -438,7 +438,7 @@ public function testIsOffsetAccessible(BenevolentUnionType $type, TrinaryLogic $ ); } - public function dataHasOffsetValueType(): Iterator + public static function dataHasOffsetValueType(): Iterator { yield [ new BenevolentUnionType([ @@ -476,7 +476,7 @@ public function testHasOffsetValue(BenevolentUnionType $type, Type $offsetType, ); } - public function dataIsCallable(): Iterator + public static function dataIsCallable(): Iterator { yield [ new BenevolentUnionType([new CallableType(), new CallableType()]), @@ -505,7 +505,7 @@ public function testIsCallable(BenevolentUnionType $type, TrinaryLogic $expected ); } - public function dataIsCloneable(): Iterator + public static function dataIsCloneable(): Iterator { yield [ new BenevolentUnionType([new ObjectWithoutClassType(), new ObjectWithoutClassType()]), diff --git a/tests/PHPStan/Type/BitwiseFlagHelperTest.php b/tests/PHPStan/Type/BitwiseFlagHelperTest.php index 7703524f47..eac74b92ce 100644 --- a/tests/PHPStan/Type/BitwiseFlagHelperTest.php +++ b/tests/PHPStan/Type/BitwiseFlagHelperTest.php @@ -18,7 +18,7 @@ final class BitwiseFlagHelperTest extends PHPStanTestCase { - public function dataUnknownConstants(): array + public static function dataUnknownConstants(): array { return [ [ @@ -45,7 +45,7 @@ public function dataUnknownConstants(): array ]; } - public function dataJsonExprContainsConst(): array + public static function dataJsonExprContainsConst(): array { if (!defined('JSON_THROW_ON_ERROR')) { return []; @@ -135,7 +135,7 @@ public function testExprContainsConst(Expr $expr, string $constName, TrinaryLogi ->assignVariable('unionIntFloatVar', new UnionType([new IntegerType(), new FloatType()]), new UnionType([new IntegerType(), new FloatType()]), TrinaryLogic::createYes()) ->assignVariable('unionStringFloatVar', new UnionType([new StringType(), new FloatType()]), new UnionType([new StringType(), new FloatType()]), TrinaryLogic::createYes()); - $analyser = new BitwiseFlagHelper($this->createReflectionProvider()); + $analyser = new BitwiseFlagHelper(self::createReflectionProvider()); $actual = $analyser->bitwiseOrContainsConstant($expr, $scope, $constName); $this->assertTrue($expected->equals($actual), sprintf('Expected Trinary::%s but got Trinary::%s.', $expected->describe(), $actual->describe())); } diff --git a/tests/PHPStan/Type/BooleanTypeTest.php b/tests/PHPStan/Type/BooleanTypeTest.php index f7552cba51..8b8b7a1ff8 100644 --- a/tests/PHPStan/Type/BooleanTypeTest.php +++ b/tests/PHPStan/Type/BooleanTypeTest.php @@ -11,7 +11,7 @@ class BooleanTypeTest extends PHPStanTestCase { - public function dataAccepts(): array + public static function dataAccepts(): array { return [ [ @@ -60,7 +60,7 @@ public function testAccepts(BooleanType $type, Type $otherType, TrinaryLogic $ex ); } - public function dataIsSuperTypeOf(): iterable + public static function dataIsSuperTypeOf(): iterable { yield [ new BooleanType(), @@ -106,7 +106,7 @@ public function testIsSuperTypeOf(BooleanType $type, Type $otherType, TrinaryLog ); } - public function dataEquals(): array + public static function dataEquals(): array { return [ [ diff --git a/tests/PHPStan/Type/CallableTypeTest.php b/tests/PHPStan/Type/CallableTypeTest.php index 739267f0e5..30b543058e 100644 --- a/tests/PHPStan/Type/CallableTypeTest.php +++ b/tests/PHPStan/Type/CallableTypeTest.php @@ -22,7 +22,7 @@ class CallableTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { return [ [ @@ -74,7 +74,7 @@ public function testIsSuperTypeOf(CallableType $type, Type $otherType, TrinaryLo ); } - public function dataIsSubTypeOf(): array + public static function dataIsSubTypeOf(): array { return [ [ @@ -166,7 +166,7 @@ public function testIsSubTypeOfInversed(CallableType $type, Type $otherType, Tri ); } - public function dataInferTemplateTypes(): array + public static function dataInferTemplateTypes(): array { $param = static fn (Type $type): NativeParameterReflection => new NativeParameterReflection( '', @@ -280,7 +280,7 @@ public function testResolveTemplateTypes(Type $received, Type $template, array $ ); } - public function dataAccepts(): array + public static function dataAccepts(): array { return [ [ diff --git a/tests/PHPStan/Type/ClassStringTypeTest.php b/tests/PHPStan/Type/ClassStringTypeTest.php index f4d19a2760..06dd312d59 100644 --- a/tests/PHPStan/Type/ClassStringTypeTest.php +++ b/tests/PHPStan/Type/ClassStringTypeTest.php @@ -13,7 +13,7 @@ class ClassStringTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { return [ [ @@ -52,7 +52,7 @@ public function testIsSuperTypeOf(ClassStringType $type, Type $otherType, Trinar ); } - public function dataAccepts(): iterable + public static function dataAccepts(): iterable { yield [ new ClassStringType(), @@ -116,7 +116,7 @@ public function testAccepts(ClassStringType $type, Type $otherType, TrinaryLogic ); } - public function dataEquals(): array + public static function dataEquals(): array { return [ [ diff --git a/tests/PHPStan/Type/ClosureTypeFactoryTest.php b/tests/PHPStan/Type/ClosureTypeFactoryTest.php index 7e3a4537b3..d91e609ae5 100644 --- a/tests/PHPStan/Type/ClosureTypeFactoryTest.php +++ b/tests/PHPStan/Type/ClosureTypeFactoryTest.php @@ -8,7 +8,7 @@ class ClosureTypeFactoryTest extends PHPStanTestCase { - public function dataFromClosureObjectReturnType(): array + public static function dataFromClosureObjectReturnType(): array { return [ [static function (): void { @@ -30,7 +30,7 @@ public function testFromClosureObjectReturnType(Closure $closure, string $return $this->assertSame($returnType, $closureType->getReturnType()->describe(VerbosityLevel::precise())); } - public function dataFromClosureObjectParameter(): array + public static function dataFromClosureObjectParameter(): array { return [ [static function (string $foo): void { diff --git a/tests/PHPStan/Type/ClosureTypeTest.php b/tests/PHPStan/Type/ClosureTypeTest.php index 5602adf7b9..0977874bcc 100644 --- a/tests/PHPStan/Type/ClosureTypeTest.php +++ b/tests/PHPStan/Type/ClosureTypeTest.php @@ -10,7 +10,7 @@ class ClosureTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { return [ [ diff --git a/tests/PHPStan/Type/Constant/ConstantArrayTypeTest.php b/tests/PHPStan/Type/Constant/ConstantArrayTypeTest.php index 2fca7b7d97..a19e0c8f5a 100644 --- a/tests/PHPStan/Type/Constant/ConstantArrayTypeTest.php +++ b/tests/PHPStan/Type/Constant/ConstantArrayTypeTest.php @@ -31,7 +31,7 @@ class ConstantArrayTypeTest extends PHPStanTestCase { - public function dataAccepts(): iterable + public static function dataAccepts(): iterable { yield [ new ConstantArrayType([], []), @@ -422,7 +422,7 @@ public function testAccepts(Type $type, Type $otherType, TrinaryLogic $expectedR ); } - public function dataIsSuperTypeOf(): iterable + public static function dataIsSuperTypeOf(): iterable { yield [ new ConstantArrayType([], []), @@ -706,7 +706,7 @@ public function testIsSuperTypeOf(ConstantArrayType $type, Type $otherType, Trin ); } - public function dataInferTemplateTypes(): array + public static function dataInferTemplateTypes(): array { $templateType = static fn ($name): Type => TemplateTypeFactory::create( TemplateTypeScope::createWithFunction('a'), @@ -837,7 +837,7 @@ public function testIsCallable(ConstantArrayType $type, TrinaryLogic $expectedRe ); } - public function dataIsCallable(): iterable + public static function dataIsCallable(): iterable { yield 'zero items' => [ new ConstantArrayType([], []), @@ -909,7 +909,7 @@ public function dataIsCallable(): iterable ]; } - public function dataValuesArray(): iterable + public static function dataValuesArray(): iterable { yield 'empty' => [ new ConstantArrayType([], []), diff --git a/tests/PHPStan/Type/Constant/ConstantFloatTypeTest.php b/tests/PHPStan/Type/Constant/ConstantFloatTypeTest.php index 2122e3c829..623e9e11a8 100644 --- a/tests/PHPStan/Type/Constant/ConstantFloatTypeTest.php +++ b/tests/PHPStan/Type/Constant/ConstantFloatTypeTest.php @@ -8,7 +8,7 @@ class ConstantFloatTypeTest extends PHPStanTestCase { - public function dataDescribe(): array + public static function dataDescribe(): array { return [ [ diff --git a/tests/PHPStan/Type/Constant/ConstantIntegerTypeTest.php b/tests/PHPStan/Type/Constant/ConstantIntegerTypeTest.php index c33c33e5a6..1319bc0c66 100644 --- a/tests/PHPStan/Type/Constant/ConstantIntegerTypeTest.php +++ b/tests/PHPStan/Type/Constant/ConstantIntegerTypeTest.php @@ -12,7 +12,7 @@ class ConstantIntegerTypeTest extends PHPStanTestCase { - public function dataAccepts(): iterable + public static function dataAccepts(): iterable { yield [ new ConstantIntegerType(1), @@ -46,7 +46,7 @@ public function testAccepts(ConstantIntegerType $type, Type $otherType, TrinaryL ); } - public function dataIsSuperTypeOf(): iterable + public static function dataIsSuperTypeOf(): iterable { yield [ new ConstantIntegerType(1), diff --git a/tests/PHPStan/Type/Constant/ConstantStringTypeTest.php b/tests/PHPStan/Type/Constant/ConstantStringTypeTest.php index 2098a1f02b..fee3036b3d 100644 --- a/tests/PHPStan/Type/Constant/ConstantStringTypeTest.php +++ b/tests/PHPStan/Type/Constant/ConstantStringTypeTest.php @@ -24,9 +24,9 @@ class ConstantStringTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return [ 0 => [ new ConstantStringType(Exception::class), diff --git a/tests/PHPStan/Type/Constant/OversizedArrayBuilderTest.php b/tests/PHPStan/Type/Constant/OversizedArrayBuilderTest.php index cd278837d6..5051471e0d 100644 --- a/tests/PHPStan/Type/Constant/OversizedArrayBuilderTest.php +++ b/tests/PHPStan/Type/Constant/OversizedArrayBuilderTest.php @@ -14,7 +14,7 @@ class OversizedArrayBuilderTest extends PHPStanTestCase { - public function dataBuild(): iterable + public static function dataBuild(): iterable { yield [ '[1, 2, 3]', diff --git a/tests/PHPStan/Type/Enum/EnumCaseObjectTypeTest.php b/tests/PHPStan/Type/Enum/EnumCaseObjectTypeTest.php index 1bf9013c42..a0db6c2344 100644 --- a/tests/PHPStan/Type/Enum/EnumCaseObjectTypeTest.php +++ b/tests/PHPStan/Type/Enum/EnumCaseObjectTypeTest.php @@ -16,7 +16,7 @@ class EnumCaseObjectTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): iterable + public static function dataIsSuperTypeOf(): iterable { yield [ new ObjectType('PHPStan\Fixture\TestEnum'), @@ -118,7 +118,7 @@ public function testIsSuperTypeOf(Type $type, Type $otherType, TrinaryLogic $exp ); } - public function dataAccepts(): iterable + public static function dataAccepts(): iterable { yield [ new ObjectType('PHPStan\Fixture\TestEnum'), diff --git a/tests/PHPStan/Type/FileTypeMapperTest.php b/tests/PHPStan/Type/FileTypeMapperTest.php index c1af0c7740..d0f5efc7b5 100644 --- a/tests/PHPStan/Type/FileTypeMapperTest.php +++ b/tests/PHPStan/Type/FileTypeMapperTest.php @@ -160,7 +160,7 @@ public function testFileThrowsPhpDocs(): void public function testFileWithCyclicPhpDocs(): void { - $this->createReflectionProvider(); + self::createReflectionProvider(); /** @var FileTypeMapper $fileTypeMapper */ $fileTypeMapper = self::getContainer()->getByType(FileTypeMapper::class); diff --git a/tests/PHPStan/Type/FloatTypeTest.php b/tests/PHPStan/Type/FloatTypeTest.php index 04a9c270ca..43b7083d8f 100644 --- a/tests/PHPStan/Type/FloatTypeTest.php +++ b/tests/PHPStan/Type/FloatTypeTest.php @@ -12,7 +12,7 @@ class FloatTypeTest extends PHPStanTestCase { - public function dataAccepts(): array + public static function dataAccepts(): array { return [ [ @@ -74,7 +74,7 @@ public function testAccepts(Type $otherType, TrinaryLogic $expectedResult): void ); } - public function dataEquals(): array + public static function dataEquals(): array { return [ [ diff --git a/tests/PHPStan/Type/Generic/GenericClassStringTypeTest.php b/tests/PHPStan/Type/Generic/GenericClassStringTypeTest.php index ef6a0faf8d..3dd8b17a11 100644 --- a/tests/PHPStan/Type/Generic/GenericClassStringTypeTest.php +++ b/tests/PHPStan/Type/Generic/GenericClassStringTypeTest.php @@ -27,9 +27,9 @@ class GenericClassStringTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return [ 0 => [ @@ -171,7 +171,7 @@ public function testIsSuperTypeOf(GenericClassStringType $type, Type $otherType, ); } - public function dataAccepts(): array + public static function dataAccepts(): array { return [ 0 => [ @@ -292,9 +292,9 @@ public function testAccepts( ); } - public function dataEquals(): array + public static function dataEquals(): array { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return [ [ diff --git a/tests/PHPStan/Type/Generic/GenericObjectTypeTest.php b/tests/PHPStan/Type/Generic/GenericObjectTypeTest.php index 53988eac7a..e7df51b9e9 100644 --- a/tests/PHPStan/Type/Generic/GenericObjectTypeTest.php +++ b/tests/PHPStan/Type/Generic/GenericObjectTypeTest.php @@ -31,7 +31,7 @@ class GenericObjectTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { return [ 'equal type' => [ @@ -198,7 +198,7 @@ public function dataIsSuperTypeOf(): array ]; } - public function dataTypeProjections(): array + public static function dataTypeProjections(): array { $invariantA = new GenericObjectType(E\Foo::class, [new ObjectType(E\A::class)], variances: [TemplateTypeVariance::createInvariant()]); $invariantB = new GenericObjectType(E\Foo::class, [new ObjectType(E\B::class)], variances: [TemplateTypeVariance::createInvariant()]); @@ -275,7 +275,7 @@ public function testIsSuperTypeOf(Type $type, Type $otherType, TrinaryLogic $exp ); } - public function dataAccepts(): array + public static function dataAccepts(): array { return [ 'equal type' => [ @@ -350,7 +350,7 @@ public function testAccepts( } /** @return array}> */ - public function dataInferTemplateTypes(): array + public static function dataInferTemplateTypes(): array { $templateType = static fn ($name, ?Type $bound = null): Type => TemplateTypeFactory::create( TemplateTypeScope::createWithFunction('a'), @@ -463,7 +463,7 @@ public function testResolveTemplateTypes(Type $received, Type $template, array $ } /** @return array}> */ - public function dataGetReferencedTypeArguments(): array + public static function dataGetReferencedTypeArguments(): array { $templateType = static fn ($name, ?Type $bound = null): Type => TemplateTypeFactory::create( TemplateTypeScope::createWithFunction('a'), diff --git a/tests/PHPStan/Type/Generic/TemplateTypeMapTest.php b/tests/PHPStan/Type/Generic/TemplateTypeMapTest.php index ff9f5fe58e..242d66da69 100644 --- a/tests/PHPStan/Type/Generic/TemplateTypeMapTest.php +++ b/tests/PHPStan/Type/Generic/TemplateTypeMapTest.php @@ -11,7 +11,7 @@ class TemplateTypeMapTest extends TestCase { - public function dataUnionWithLowerBoundTypes(): iterable + public static function dataUnionWithLowerBoundTypes(): iterable { $map = (new TemplateTypeMap([ 'T' => new ObjectType(Exception::class), diff --git a/tests/PHPStan/Type/Generic/TemplateTypeVarianceTest.php b/tests/PHPStan/Type/Generic/TemplateTypeVarianceTest.php index c5bd9ac0a6..a7db656211 100644 --- a/tests/PHPStan/Type/Generic/TemplateTypeVarianceTest.php +++ b/tests/PHPStan/Type/Generic/TemplateTypeVarianceTest.php @@ -15,7 +15,7 @@ class TemplateTypeVarianceTest extends TestCase { - public function dataIsValidVariance(): iterable + public static function dataIsValidVariance(): iterable { foreach ([TemplateTypeVariance::createInvariant(), TemplateTypeVariance::createCovariant()] as $variance) { yield [ diff --git a/tests/PHPStan/Type/IntegerTypeTest.php b/tests/PHPStan/Type/IntegerTypeTest.php index 79c3ef9560..6b7dc51958 100644 --- a/tests/PHPStan/Type/IntegerTypeTest.php +++ b/tests/PHPStan/Type/IntegerTypeTest.php @@ -12,7 +12,7 @@ class IntegerTypeTest extends PHPStanTestCase { - public function dataAccepts(): array + public static function dataAccepts(): array { return [ [ @@ -61,7 +61,7 @@ public function testAccepts(IntegerType $type, Type $otherType, TrinaryLogic $ex ); } - public function dataIsSuperTypeOf(): iterable + public static function dataIsSuperTypeOf(): iterable { yield [ new IntegerType(), @@ -107,7 +107,7 @@ public function testIsSuperTypeOf(IntegerType $type, Type $otherType, TrinaryLog ); } - public function dataEquals(): array + public static function dataEquals(): array { return [ [ diff --git a/tests/PHPStan/Type/IntersectionTypeTest.php b/tests/PHPStan/Type/IntersectionTypeTest.php index d5259d53e5..f4143a0f37 100644 --- a/tests/PHPStan/Type/IntersectionTypeTest.php +++ b/tests/PHPStan/Type/IntersectionTypeTest.php @@ -27,7 +27,7 @@ class IntersectionTypeTest extends PHPStanTestCase { - public function dataAccepts(): Iterator + public static function dataAccepts(): Iterator { $intersectionType = new IntersectionType([ new ObjectType('Collection'), @@ -81,7 +81,7 @@ public function testAccepts(IntersectionType $type, Type $otherType, TrinaryLogi ); } - public function dataIsCallable(): array + public static function dataIsCallable(): array { return [ [ @@ -124,7 +124,7 @@ public function testIsCallable(IntersectionType $type, TrinaryLogic $expectedRes ); } - public function dataIsSuperTypeOf(): Iterator + public static function dataIsSuperTypeOf(): Iterator { $intersectionTypeA = new IntersectionType([ new ObjectType('ArrayObject'), @@ -247,7 +247,7 @@ public function testIsSuperTypeOf(IntersectionType $type, Type $otherType, Trina ); } - public function dataIsSubTypeOf(): Iterator + public static function dataIsSubTypeOf(): Iterator { $intersectionTypeA = new IntersectionType([ new ObjectType('ArrayObject'), @@ -366,13 +366,13 @@ public function testToBooleanCrash(): void $this->assertSame('true', $type->toBoolean()->describe(VerbosityLevel::precise())); } - public function dataGetEnumCases(): iterable + public static function dataGetEnumCases(): iterable { if (PHP_VERSION_ID < 80100) { return []; } - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $classReflection = $reflectionProvider->getClass(FooEnum::class); yield [ @@ -403,7 +403,7 @@ public function testGetEnumCases( } } - public function dataDescribe(): iterable + public static function dataDescribe(): iterable { yield [ new IntersectionType([new StringType(), new AccessoryLowercaseStringType()]), diff --git a/tests/PHPStan/Type/IterableTypeTest.php b/tests/PHPStan/Type/IterableTypeTest.php index 013c0fd15c..ec6763a39c 100644 --- a/tests/PHPStan/Type/IterableTypeTest.php +++ b/tests/PHPStan/Type/IterableTypeTest.php @@ -17,7 +17,7 @@ class IterableTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { return [ [ @@ -71,7 +71,7 @@ public function testIsSuperTypeOf(IterableType $type, Type $otherType, TrinaryLo ); } - public function dataIsSubTypeOf(): array + public static function dataIsSubTypeOf(): array { return [ [ @@ -183,7 +183,7 @@ public function testIsSubTypeOfInversed(IterableType $type, Type $otherType, Tri ); } - public function dataInferTemplateTypes(): array + public static function dataInferTemplateTypes(): array { $templateType = static fn ($name): Type => TemplateTypeFactory::create( TemplateTypeScope::createWithFunction('a'), @@ -248,7 +248,7 @@ public function testResolveTemplateTypes(Type $received, Type $template, array $ ); } - public function dataDescribe(): array + public static function dataDescribe(): array { $templateType = TemplateTypeFactory::create( TemplateTypeScope::createWithFunction('a'), @@ -295,7 +295,7 @@ public function testDescribe(Type $type, string $expect): void $this->assertSame($expect, $result); } - public function dataAccepts(): array + public static function dataAccepts(): array { /** @var TemplateMixedType $t */ $t = TemplateTypeFactory::create( diff --git a/tests/PHPStan/Type/MixedTypeTest.php b/tests/PHPStan/Type/MixedTypeTest.php index 5322385963..01f19e01c4 100644 --- a/tests/PHPStan/Type/MixedTypeTest.php +++ b/tests/PHPStan/Type/MixedTypeTest.php @@ -18,7 +18,7 @@ class MixedTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { return [ 0 => [ @@ -172,7 +172,7 @@ public function testIsSuperTypeOf(MixedType $type, Type $otherType, TrinaryLogic ); } - public function dataSubstractedIsArray(): array + public static function dataSubstractedIsArray(): array { return [ [ @@ -241,7 +241,7 @@ public function testSubstractedIsArray(MixedType $mixedType, Type $typeToSubtrac ); } - public function dataSubstractedIsConstantArray(): array + public static function dataSubstractedIsConstantArray(): array { return [ [ @@ -315,7 +315,7 @@ public function testSubstractedIsConstantArray(MixedType $mixedType, Type $typeT ); } - public function dataSubstractedIsString(): array + public static function dataSubstractedIsString(): array { return [ [ @@ -367,7 +367,7 @@ public function testSubstractedIsString(MixedType $mixedType, Type $typeToSubtra ); } - public function dataSubstractedIsNumericString(): array + public static function dataSubstractedIsNumericString(): array { return [ [ @@ -419,7 +419,7 @@ public function testSubstractedIsNumericString(MixedType $mixedType, Type $typeT ); } - public function dataSubstractedIsNonEmptyString(): array + public static function dataSubstractedIsNonEmptyString(): array { return [ [ @@ -479,7 +479,7 @@ public function testSubstractedIsNonEmptyString(MixedType $mixedType, Type $type ); } - public function dataSubstractedIsNonFalsyString(): array + public static function dataSubstractedIsNonFalsyString(): array { return [ [ @@ -539,7 +539,7 @@ public function testSubstractedIsNonFalsyString(MixedType $mixedType, Type $type ); } - public function dataSubstractedIsLiteralString(): array + public static function dataSubstractedIsLiteralString(): array { return [ [ @@ -607,7 +607,7 @@ public function testSubstractedIsClassString(MixedType $mixedType, Type $typeToS ); } - public function dataSubstractedIsClassString(): array + public static function dataSubstractedIsClassString(): array { return [ [ @@ -649,7 +649,7 @@ public function testSubtractedIsVoid(MixedType $mixedType, Type $typeToSubtract, ); } - public function dataSubtractedIsVoid(): array + public static function dataSubtractedIsVoid(): array { return [ [ @@ -678,7 +678,7 @@ public function testSubtractedIsScalar(MixedType $mixedType, Type $typeToSubtrac ); } - public function dataSubtractedIsScalar(): array + public static function dataSubtractedIsScalar(): array { return [ [ @@ -709,7 +709,7 @@ public function testSubstractedIsLiteralString(MixedType $mixedType, Type $typeT ); } - public function dataSubstractedIsIterable(): array + public static function dataSubstractedIsIterable(): array { return [ [ @@ -763,7 +763,7 @@ public function testSubstractedIsBoolean(MixedType $mixedType, Type $typeToSubtr ); } - public function dataSubstractedIsBoolean(): array + public static function dataSubstractedIsBoolean(): array { return [ [ @@ -804,7 +804,7 @@ public function testSubstractedIsFalse(MixedType $mixedType, Type $typeToSubtrac ); } - public function dataSubstractedIsFalse(): array + public static function dataSubstractedIsFalse(): array { return [ [ @@ -845,7 +845,7 @@ public function testSubstractedIsNull(MixedType $mixedType, Type $typeToSubtract ); } - public function dataSubstractedIsNull(): array + public static function dataSubstractedIsNull(): array { return [ [ @@ -891,7 +891,7 @@ public function testSubstractedIsTrue(MixedType $mixedType, Type $typeToSubtract ); } - public function dataSubstractedIsTrue(): array + public static function dataSubstractedIsTrue(): array { return [ [ @@ -932,7 +932,7 @@ public function testSubstractedIsFloat(MixedType $mixedType, Type $typeToSubtrac ); } - public function dataSubstractedIsFloat(): array + public static function dataSubstractedIsFloat(): array { return [ [ @@ -968,7 +968,7 @@ public function testSubstractedIsInteger(MixedType $mixedType, Type $typeToSubtr ); } - public function dataSubstractedIsInteger(): array + public static function dataSubstractedIsInteger(): array { return [ [ @@ -1004,7 +1004,7 @@ public function testSubstractedIsIterable(MixedType $mixedType, Type $typeToSubt ); } - public function dataSubstractedIsOffsetAccessible(): array + public static function dataSubstractedIsOffsetAccessible(): array { return [ [ @@ -1059,7 +1059,7 @@ public function testSubstractedIsOffsetAccessible(MixedType $mixedType, Type $ty ); } - public function dataSubstractedIsOffsetLegal(): array + public static function dataSubstractedIsOffsetLegal(): array { return [ [ @@ -1106,7 +1106,7 @@ public function testSubstractedIsOffsetLegal(MixedType $mixedType, Type $typeToS ); } - public function dataSubtractedHasOffsetValueType(): array + public static function dataSubtractedHasOffsetValueType(): array { return [ [ diff --git a/tests/PHPStan/Type/ObjectTypeTest.php b/tests/PHPStan/Type/ObjectTypeTest.php index 9a1bdf2fea..2babe378f4 100644 --- a/tests/PHPStan/Type/ObjectTypeTest.php +++ b/tests/PHPStan/Type/ObjectTypeTest.php @@ -47,7 +47,7 @@ class ObjectTypeTest extends PHPStanTestCase { - public function dataIsIterable(): array + public static function dataIsIterable(): array { return [ [new ObjectType('ArrayObject'), TrinaryLogic::createYes()], @@ -73,7 +73,7 @@ public function testIsIterable(ObjectType $type, TrinaryLogic $expectedResult): /** * @return iterable */ - public function dataIsEnum(): iterable + public static function dataIsEnum(): iterable { if (PHP_VERSION_ID >= 80000) { yield [new ObjectType('UnitEnum'), TrinaryLogic::createYes()]; @@ -99,7 +99,7 @@ public function testIsEnum(ObjectType $type, TrinaryLogic $expectedResult): void ); } - public function dataIsCallable(): array + public static function dataIsCallable(): array { return [ [new ObjectType('Closure'), TrinaryLogic::createYes()], @@ -121,9 +121,9 @@ public function testIsCallable(ObjectType $type, TrinaryLogic $expectedResult): ); } - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return [ 0 => [ @@ -498,7 +498,7 @@ public function testIsSuperTypeOf(ObjectType $type, Type $otherType, TrinaryLogi ); } - public function dataAccepts(): array + public static function dataAccepts(): array { return [ [ @@ -573,7 +573,7 @@ public function testGetClassReflectionOfGenericClass(): void $this->assertSame('Traversable', $classReflection->getDisplayName()); } - public function dataHasOffsetValueType(): array + public static function dataHasOffsetValueType(): array { return [ [ @@ -645,7 +645,7 @@ public function testHasOffsetValueType( ); } - public function dataGetEnumCases(): iterable + public static function dataGetEnumCases(): iterable { yield [ new ObjectType(stdClass::class), diff --git a/tests/PHPStan/Type/ObjectWithoutClassTypeTest.php b/tests/PHPStan/Type/ObjectWithoutClassTypeTest.php index c5fde900ce..3b3378cec0 100644 --- a/tests/PHPStan/Type/ObjectWithoutClassTypeTest.php +++ b/tests/PHPStan/Type/ObjectWithoutClassTypeTest.php @@ -10,7 +10,7 @@ class ObjectWithoutClassTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { return [ [ diff --git a/tests/PHPStan/Type/Regex/RegexExpressionHelperTest.php b/tests/PHPStan/Type/Regex/RegexExpressionHelperTest.php index 330594145f..46498fda80 100644 --- a/tests/PHPStan/Type/Regex/RegexExpressionHelperTest.php +++ b/tests/PHPStan/Type/Regex/RegexExpressionHelperTest.php @@ -7,7 +7,7 @@ class RegexExpressionHelperTest extends PHPStanTestCase { - public function dataRemoveDelimitersAndModifiers(): array + public static function dataRemoveDelimitersAndModifiers(): array { return [ [ diff --git a/tests/PHPStan/Type/SimultaneousTypeTraverserTest.php b/tests/PHPStan/Type/SimultaneousTypeTraverserTest.php index 3917423ff3..8161b624f9 100644 --- a/tests/PHPStan/Type/SimultaneousTypeTraverserTest.php +++ b/tests/PHPStan/Type/SimultaneousTypeTraverserTest.php @@ -10,7 +10,7 @@ class SimultaneousTypeTraverserTest extends PHPStanTestCase { - public function dataChangeStringIntoNonEmptyString(): iterable + public static function dataChangeStringIntoNonEmptyString(): iterable { yield [ new StringType(), diff --git a/tests/PHPStan/Type/StaticTypeTest.php b/tests/PHPStan/Type/StaticTypeTest.php index c681142840..bc9b80b0d6 100644 --- a/tests/PHPStan/Type/StaticTypeTest.php +++ b/tests/PHPStan/Type/StaticTypeTest.php @@ -28,9 +28,9 @@ class StaticTypeTest extends PHPStanTestCase { - public function dataIsIterable(): array + public static function dataIsIterable(): array { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return [ [new StaticType($reflectionProvider->getClass('ArrayObject')), TrinaryLogic::createYes()], @@ -52,9 +52,9 @@ public function testIsIterable(StaticType $type, TrinaryLogic $expectedResult): ); } - public function dataIsCallable(): array + public static function dataIsCallable(): array { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return [ [new StaticType($reflectionProvider->getClass('Closure')), TrinaryLogic::createYes()], @@ -75,9 +75,9 @@ public function testIsCallable(StaticType $type, TrinaryLogic $expectedResult): ); } - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return [ 1 => [ new StaticType($reflectionProvider->getClass(ArrayAccess::class)), @@ -304,9 +304,9 @@ public function testIsSuperTypeOf(Type $type, Type $otherType, TrinaryLogic $exp ); } - public function dataEquals(): array + public static function dataEquals(): array { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return [ [ @@ -341,9 +341,9 @@ public function testEquals(StaticType $type, StaticType $otherType, bool $expect $this->assertSame($expected, $otherType->equals($type)); } - public function dataAccepts(): iterable + public static function dataAccepts(): iterable { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $c = $reflectionProvider->getClass(C::class); yield [ diff --git a/tests/PHPStan/Type/StringTypeTest.php b/tests/PHPStan/Type/StringTypeTest.php index 813349b91a..b31979633b 100644 --- a/tests/PHPStan/Type/StringTypeTest.php +++ b/tests/PHPStan/Type/StringTypeTest.php @@ -18,7 +18,7 @@ class StringTypeTest extends PHPStanTestCase { - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { return [ [ @@ -107,7 +107,7 @@ public function testIsSuperTypeOf(StringType $type, Type $otherType, TrinaryLogi ); } - public function dataAccepts(): iterable + public static function dataAccepts(): iterable { yield [ new StringType(), @@ -187,7 +187,7 @@ public function testAccepts(StringType $type, Type $otherType, TrinaryLogic $exp ); } - public function dataEquals(): array + public static function dataEquals(): array { return [ [ diff --git a/tests/PHPStan/Type/TemplateTypeTest.php b/tests/PHPStan/Type/TemplateTypeTest.php index 6b184eef8a..4eead2fc37 100644 --- a/tests/PHPStan/Type/TemplateTypeTest.php +++ b/tests/PHPStan/Type/TemplateTypeTest.php @@ -23,7 +23,7 @@ class TemplateTypeTest extends PHPStanTestCase { - public function dataAccepts(): array + public static function dataAccepts(): array { $templateType = static fn ($name, ?Type $bound, ?string $functionName = null): Type => TemplateTypeFactory::create( TemplateTypeScope::createWithFunction($functionName ?? '_'), @@ -125,7 +125,7 @@ public function testAccepts( ); } - public function dataIsSuperTypeOf(): array + public static function dataIsSuperTypeOf(): array { $templateType = static fn ($name, ?Type $bound, ?string $functionName = null): Type => TemplateTypeFactory::create( TemplateTypeScope::createWithFunction($functionName ?? '_'), @@ -313,7 +313,7 @@ public function testIsSuperTypeOf( } /** @return array}> */ - public function dataInferTemplateTypes(): array + public static function dataInferTemplateTypes(): array { $templateType = static fn ($name, ?Type $bound = null, ?string $functionName = null): Type => TemplateTypeFactory::create( TemplateTypeScope::createWithFunction($functionName ?? '_'), diff --git a/tests/PHPStan/Type/TestDecimalOperatorTypeSpecifyingExtensionTest.php b/tests/PHPStan/Type/TestDecimalOperatorTypeSpecifyingExtensionTest.php index 55f44ec4fe..88aca2ce8c 100644 --- a/tests/PHPStan/Type/TestDecimalOperatorTypeSpecifyingExtensionTest.php +++ b/tests/PHPStan/Type/TestDecimalOperatorTypeSpecifyingExtensionTest.php @@ -21,7 +21,7 @@ public function testSupportsMatchingSigilsAndSides(string $sigil, Type $leftType self::assertTrue($result); } - public function dataSigilAndSidesProvider(): iterable + public static function dataSigilAndSidesProvider(): iterable { yield '+' => [ '+', @@ -72,7 +72,7 @@ public function testNotSupportsNotMatchingSides(string $sigil, Type $leftType, T self::assertFalse($result); } - public function dataNotMatchingSidesProvider(): iterable + public static function dataNotMatchingSidesProvider(): iterable { yield 'left' => [ '+', diff --git a/tests/PHPStan/Type/TypeCombinatorTest.php b/tests/PHPStan/Type/TypeCombinatorTest.php index f7f7fceb12..92a320363d 100644 --- a/tests/PHPStan/Type/TypeCombinatorTest.php +++ b/tests/PHPStan/Type/TypeCombinatorTest.php @@ -65,7 +65,7 @@ class TypeCombinatorTest extends PHPStanTestCase { - public function dataAddNull(): array + public static function dataAddNull(): array { return [ [ @@ -157,9 +157,9 @@ public function testUnionWithNull( $this->assertInstanceOf($expectedTypeClass, $result); } - public function dataRemoveNull(): array + public static function dataRemoveNull(): array { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); return [ [ @@ -260,7 +260,7 @@ public function testRemoveNull( $this->assertInstanceOf($expectedTypeClass, $result); } - public function dataUnion(): iterable + public static function dataUnion(): iterable { yield from [ [ @@ -2227,7 +2227,7 @@ public function dataUnion(): iterable 'mixed~int<17, 18>=implicit', ]; - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); yield [ [ new StaticType($reflectionProvider->getClass(stdClass::class)), @@ -2893,9 +2893,9 @@ public function testUnionInversed( $this->assertInstanceOf($expectedTypeClass, $actualType); } - public function dataIntersect(): iterable + public static function dataIntersect(): iterable { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); yield from [ [ @@ -4811,7 +4811,7 @@ public function testIntersectInversed( $this->assertInstanceOf($expectedTypeClass, $actualType); } - public function dataRemove(): array + public static function dataRemove(): array { return [ [ @@ -5363,7 +5363,7 @@ public function testContainsNull( $this->assertSame($expectedResult, TypeCombinator::containsNull($type)); } - public function dataContainsNull(): iterable + public static function dataContainsNull(): iterable { yield [new NullType(), true]; yield [new UnionType([new IntegerType(), new NullType()]), true]; diff --git a/tests/PHPStan/Type/TypeGetFiniteTypesTest.php b/tests/PHPStan/Type/TypeGetFiniteTypesTest.php index 758ecbbb69..d64e96e047 100644 --- a/tests/PHPStan/Type/TypeGetFiniteTypesTest.php +++ b/tests/PHPStan/Type/TypeGetFiniteTypesTest.php @@ -14,7 +14,7 @@ class TypeGetFiniteTypesTest extends PHPStanTestCase { - public function dataGetFiniteTypes(): iterable + public static function dataGetFiniteTypes(): iterable { yield [ IntegerRangeType::fromInterval(0, 5), diff --git a/tests/PHPStan/Type/TypeToPhpDocNodeTest.php b/tests/PHPStan/Type/TypeToPhpDocNodeTest.php index 8947396deb..95103ab3fb 100644 --- a/tests/PHPStan/Type/TypeToPhpDocNodeTest.php +++ b/tests/PHPStan/Type/TypeToPhpDocNodeTest.php @@ -28,7 +28,7 @@ class TypeToPhpDocNodeTest extends PHPStanTestCase { - public function dataToPhpDocNode(): iterable + public static function dataToPhpDocNode(): iterable { yield [ new ArrayType(new MixedType(), new MixedType()), @@ -449,7 +449,7 @@ public function testToPhpDocNode(Type $type, string $expected): void $this->assertTrue($type->equals($parsedType), sprintf('%s->equals(%s)', $type->describe(VerbosityLevel::precise()), $parsedType->describe(VerbosityLevel::precise()))); } - public function dataToPhpDocNodeWithoutCheckingEquals(): iterable + public static function dataToPhpDocNodeWithoutCheckingEquals(): iterable { yield [ new ConstantStringType("foo\nbar\nbaz"), @@ -531,9 +531,9 @@ public function testToPhpDocNodeWithoutCheckingEquals(Type $type, string $expect $typeStringResolver->resolve($typeString); } - public function dataFromTypeStringToPhpDocNode(): iterable + public static function dataFromTypeStringToPhpDocNode(): iterable { - foreach ($this->dataToPhpDocNode() as [, $typeString]) { + foreach (self::dataToPhpDocNode() as [, $typeString]) { yield [$typeString]; } diff --git a/tests/PHPStan/Type/UnionTypeTest.php b/tests/PHPStan/Type/UnionTypeTest.php index 46b5803374..0de9040ff0 100644 --- a/tests/PHPStan/Type/UnionTypeTest.php +++ b/tests/PHPStan/Type/UnionTypeTest.php @@ -38,7 +38,7 @@ class UnionTypeTest extends PHPStanTestCase { - public function dataIsCallable(): array + public static function dataIsCallable(): array { return [ [ @@ -88,9 +88,9 @@ public function testIsCallable(UnionType $type, TrinaryLogic $expectedResult): v ); } - public function dataSelfCompare(): Iterator + public static function dataSelfCompare(): Iterator { - $reflectionProvider = $this->createReflectionProvider(); + $reflectionProvider = self::createReflectionProvider(); $integerType = new IntegerType(); $stringType = new StringType(); @@ -170,7 +170,7 @@ public function testSelfCompare(Type $type): void ); } - public function dataIsSuperTypeOf(): Iterator + public static function dataIsSuperTypeOf(): Iterator { $unionTypeA = new UnionType([ new IntegerType(), @@ -466,7 +466,7 @@ public function testIsSuperTypeOf(UnionType $type, Type $otherType, TrinaryLogic ); } - public function dataIsSubTypeOf(): Iterator + public static function dataIsSubTypeOf(): Iterator { $unionTypeA = new UnionType([ new IntegerType(), @@ -647,7 +647,7 @@ public function testIsSubTypeOfInversed(UnionType $type, Type $otherType, Trinar ); } - public function dataIsScalar(): array + public static function dataIsScalar(): array { return [ [ @@ -710,7 +710,7 @@ public function testIsScalar(UnionType $type, TrinaryLogic $expectedResult): voi ); } - public function dataDescribe(): array + public static function dataDescribe(): array { return [ [ @@ -953,7 +953,7 @@ public function testDescribe( $this->assertSame($expectedTypeOnlyDescription, $type->describe(VerbosityLevel::typeOnly())); } - public function dataAccepts(): iterable + public static function dataAccepts(): iterable { yield from [ [ @@ -1310,7 +1310,7 @@ public function testAccepts( ); } - public function dataHasMethod(): array + public static function dataHasMethod(): array { return [ [ @@ -1409,7 +1409,7 @@ public function testGetConstantArrays( $this->assertSame($expectedDescriptions, $actualDescriptions); } - public function dataGetConstantArrays(): iterable + public static function dataGetConstantArrays(): iterable { yield from [ [ @@ -1470,7 +1470,7 @@ public function testGetConstantStrings( $this->assertSame($expectedDescriptions, $actualDescriptions); } - public function dataGetConstantStrings(): iterable + public static function dataGetConstantStrings(): iterable { yield from [ [ @@ -1537,7 +1537,7 @@ public function testGetObjectClassNames( $this->assertSame($expectedObjectClassNames, $unionType->getObjectClassNames()); } - public function dataGetObjectClassNames(): iterable + public static function dataGetObjectClassNames(): iterable { yield from [ [ @@ -1586,7 +1586,7 @@ public function testGetArrays( $this->assertSame($expectedDescriptions, $actualDescriptions); } - public function dataGetArrays(): iterable + public static function dataGetArrays(): iterable { yield from [ [ diff --git a/tests/PHPStan/Type/VerbosityLevelTest.php b/tests/PHPStan/Type/VerbosityLevelTest.php index 220df284b8..af663b59cf 100644 --- a/tests/PHPStan/Type/VerbosityLevelTest.php +++ b/tests/PHPStan/Type/VerbosityLevelTest.php @@ -11,7 +11,7 @@ class VerbosityLevelTest extends PHPStanTestCase { - public function dataGetRecommendedLevelByType(): iterable + public static function dataGetRecommendedLevelByType(): iterable { yield [ new BooleanType(),