From d0ec59b38d87bcaa4dab5717be98433fa3db58dc Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 14 Dec 2022 15:42:16 +0100 Subject: [PATCH] Migrate to `static` data providers using `rector/rector` --- Tests/DataCollector/DoctrineDataCollectorTest.php | 2 +- .../DoctrineDataCollectorWithDebugStackTest.php | 2 +- .../DependencyInjection/DoctrineExtensionTest.php | 6 +++--- .../Form/ChoiceList/ORMQueryBuilderLoaderTest.php | 4 ++-- Tests/Form/Type/EntityTypeTest.php | 2 +- Tests/Logger/DbalLoggerTest.php | 2 +- Tests/Middleware/Debug/MiddlewareTest.php | 6 +++--- Tests/PropertyInfo/DoctrineExtractorTest.php | 2 +- Tests/Types/UlidTypeTest.php | 2 +- Tests/Types/UuidTypeTest.php | 2 +- .../Constraints/UniqueEntityValidatorTest.php | 14 +++++++------- Tests/Validator/DoctrineLoaderTest.php | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Tests/DataCollector/DoctrineDataCollectorTest.php b/Tests/DataCollector/DoctrineDataCollectorTest.php index 25cc33fb..8146adb9 100644 --- a/Tests/DataCollector/DoctrineDataCollectorTest.php +++ b/Tests/DataCollector/DoctrineDataCollectorTest.php @@ -134,7 +134,7 @@ public function testSerialization($param, array $types, $expected) $this->assertTrue($collectedQueries['default'][0]['runnable']); } - public function paramProvider(): array + public static function paramProvider(): array { return [ ['some value', [], 'some value'], diff --git a/Tests/DataCollector/DoctrineDataCollectorWithDebugStackTest.php b/Tests/DataCollector/DoctrineDataCollectorWithDebugStackTest.php index f0962eff..64bee120 100644 --- a/Tests/DataCollector/DoctrineDataCollectorWithDebugStackTest.php +++ b/Tests/DataCollector/DoctrineDataCollectorWithDebugStackTest.php @@ -107,7 +107,7 @@ public function testSerialization($param, array $types, $expected, $explainable, $this->assertSame($runnable, $collectedQueries['default'][0]['runnable']); } - public function paramProvider(): array + public static function paramProvider(): array { return [ ['some value', [], 'some value', true], diff --git a/Tests/DependencyInjection/DoctrineExtensionTest.php b/Tests/DependencyInjection/DoctrineExtensionTest.php index b6f415e2..97cec26c 100644 --- a/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -84,7 +84,7 @@ public function testFixManagersAutoMappingsWithTwoAutomappings() $method->invoke($this->extension, $emConfigs, $bundles); } - public function getAutomappingData() + public static function getAutomappingData() { return [ [ @@ -197,7 +197,7 @@ public function testMappingTypeDetection() $this->assertSame($mappingType, \PHP_VERSION_ID < 80000 ? 'annotation' : 'attribute'); } - public function providerBasicDrivers() + public static function providerBasicDrivers() { return [ ['doctrine.orm.cache.apc.class', ['type' => 'apc']], @@ -276,7 +276,7 @@ public function testUnrecognizedCacheDriverException() $this->invokeLoadCacheDriver($objectManager, $container, $cacheName); } - public function providerBundles() + public static function providerBundles() { yield ['AnnotationsBundle', 'annotation', '/Entity']; yield ['AnnotationsOneLineBundle', 'annotation', '/Entity']; diff --git a/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php b/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php index 7d253dc5..50e08323 100644 --- a/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php +++ b/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php @@ -262,7 +262,7 @@ public function testEmbeddedIdentifierName() $loader->getEntitiesByIds('id.value', [1, '', 2, 3, 'foo']); } - public function provideGuidEntityClasses() + public static function provideGuidEntityClasses() { return [ ['Symfony\Bridge\Doctrine\Tests\Fixtures\GuidIdEntity'], @@ -270,7 +270,7 @@ public function provideGuidEntityClasses() ]; } - public function provideUidEntityClasses() + public static function provideUidEntityClasses() { return [ ['Symfony\Bridge\Doctrine\Tests\Fixtures\UuidIdEntity'], diff --git a/Tests/Form/Type/EntityTypeTest.php b/Tests/Form/Type/EntityTypeTest.php index 1e71bf68..d8491588 100644 --- a/Tests/Form/Type/EntityTypeTest.php +++ b/Tests/Form/Type/EntityTypeTest.php @@ -158,7 +158,7 @@ public function testChoiceTranslationDomainIsDisabledByDefault($expanded) } } - public function choiceTranslationDomainProvider() + public static function choiceTranslationDomainProvider() { return [ [false], diff --git a/Tests/Logger/DbalLoggerTest.php b/Tests/Logger/DbalLoggerTest.php index 710e87a1..91061632 100644 --- a/Tests/Logger/DbalLoggerTest.php +++ b/Tests/Logger/DbalLoggerTest.php @@ -43,7 +43,7 @@ public function testLog($sql, $params, $logParams) $dbalLogger->startQuery($sql, $params); } - public function getLogFixtures() + public static function getLogFixtures() { return [ ['SQL', null, []], diff --git a/Tests/Middleware/Debug/MiddlewareTest.php b/Tests/Middleware/Debug/MiddlewareTest.php index 2b8a25b4..3e24f83f 100644 --- a/Tests/Middleware/Debug/MiddlewareTest.php +++ b/Tests/Middleware/Debug/MiddlewareTest.php @@ -79,7 +79,7 @@ private function getResourceFromString(string $str) return $res; } - public function provideExecuteMethod(): array + public static function provideExecuteMethod(): array { return [ 'executeStatement' => [ @@ -173,7 +173,7 @@ public function testWithParamBound(callable $executeMethod) $this->assertGreaterThan(0, $debug[1]['executionMS']); } - public function provideEndTransactionMethod(): array + public static function provideEndTransactionMethod(): array { return [ 'commit' => [ @@ -223,7 +223,7 @@ public function testTransaction(callable $endTransactionMethod, string $expected $this->assertGreaterThan(0, $debug[6]['executionMS']); } - public function provideExecuteAndEndTransactionMethods(): array + public static function provideExecuteAndEndTransactionMethods(): array { return [ 'commit and exec' => [ diff --git a/Tests/PropertyInfo/DoctrineExtractorTest.php b/Tests/PropertyInfo/DoctrineExtractorTest.php index 42a8d656..bbe4b6ab 100644 --- a/Tests/PropertyInfo/DoctrineExtractorTest.php +++ b/Tests/PropertyInfo/DoctrineExtractorTest.php @@ -146,7 +146,7 @@ public function testExtractEnum() $this->assertNull($this->createExtractor()->getTypes(DoctrineEnum::class, 'enumCustom', [])); } - public function typesProvider() + public static function typesProvider() { $provider = [ ['id', [new Type(Type::BUILTIN_TYPE_INT)]], diff --git a/Tests/Types/UlidTypeTest.php b/Tests/Types/UlidTypeTest.php index 8fd4b8b0..06114aee 100644 --- a/Tests/Types/UlidTypeTest.php +++ b/Tests/Types/UlidTypeTest.php @@ -140,7 +140,7 @@ public function testGetGuidTypeDeclarationSQL(AbstractPlatform $platform, string $this->assertEquals($expectedDeclaration, $this->type->getSqlDeclaration(['length' => 36], $platform)); } - public function provideSqlDeclarations(): array + public static function provideSqlDeclarations(): array { return [ [new PostgreSQLPlatform(), 'UUID'], diff --git a/Tests/Types/UuidTypeTest.php b/Tests/Types/UuidTypeTest.php index 9b904b89..d49afc5f 100644 --- a/Tests/Types/UuidTypeTest.php +++ b/Tests/Types/UuidTypeTest.php @@ -152,7 +152,7 @@ public function testGetGuidTypeDeclarationSQL(AbstractPlatform $platform, string $this->assertEquals($expectedDeclaration, $this->type->getSqlDeclaration(['length' => 36], $platform)); } - public function provideSqlDeclarations(): array + public static function provideSqlDeclarations(): array { return [ [new PostgreSQLPlatform(), 'UUID'], diff --git a/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index 78d8ae01..a4e92843 100644 --- a/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -186,7 +186,7 @@ public function testValidateUniqueness(UniqueEntity $constraint) ->assertRaised(); } - public function provideUniquenessConstraints(): iterable + public static function provideUniquenessConstraints(): iterable { yield 'Doctrine style' => [new UniqueEntity([ 'message' => 'myMessage', @@ -221,7 +221,7 @@ public function testValidateCustomErrorPath(UniqueEntity $constraint) ->assertRaised(); } - public function provideConstraintsWithCustomErrorPath(): iterable + public static function provideConstraintsWithCustomErrorPath(): iterable { yield 'Doctrine style' => [new UniqueEntity([ 'message' => 'myMessage', @@ -282,7 +282,7 @@ public function testValidateUniquenessWithIgnoreNullDisabled(UniqueEntity $const ->assertRaised(); } - public function provideConstraintsWithIgnoreNullDisabled(): iterable + public static function provideConstraintsWithIgnoreNullDisabled(): iterable { yield 'Doctrine style' => [new UniqueEntity([ 'message' => 'myMessage', @@ -331,7 +331,7 @@ public function testNoValidationIfFirstFieldIsNullAndNullValuesAreIgnored(Unique $this->assertNoViolation(); } - public function provideConstraintsWithIgnoreNullEnabled(): iterable + public static function provideConstraintsWithIgnoreNullEnabled(): iterable { yield 'Doctrine style' => [new UniqueEntity([ 'message' => 'myMessage', @@ -432,7 +432,7 @@ function () use ($entity) { $this->assertNoViolation(); } - public function provideConstraintsWithCustomRepositoryMethod(): iterable + public static function provideConstraintsWithCustomRepositoryMethod(): iterable { yield 'Doctrine style' => [new UniqueEntity([ 'message' => 'myMessage', @@ -473,7 +473,7 @@ public function testValidateResultTypes($entity1, $result) $this->assertNoViolation(); } - public function resultTypesProvider() + public static function resultTypesProvider() { $entity = new SingleIntIdEntity(1, 'foo'); @@ -886,7 +886,7 @@ public function testValueCanBeNull() $this->assertNoViolation(); } - public function resultWithEmptyIterator(): array + public static function resultWithEmptyIterator(): array { $entity = new SingleIntIdEntity(1, 'foo'); diff --git a/Tests/Validator/DoctrineLoaderTest.php b/Tests/Validator/DoctrineLoaderTest.php index 034cd001..a72e78f6 100644 --- a/Tests/Validator/DoctrineLoaderTest.php +++ b/Tests/Validator/DoctrineLoaderTest.php @@ -209,7 +209,7 @@ public function testClassValidator(bool $expected, string $classValidatorRegexp $this->assertSame($expected, $doctrineLoader->loadClassMetadata($classMetadata)); } - public function regexpProvider() + public static function regexpProvider() { return [ [false, null],