From 7e82b02509b03386327ee5f3807edcf46496aaf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 24 Jan 2026 11:46:27 +0100 Subject: [PATCH] Use Rector on tests This is the configuration I used: withPaths([ __DIR__ . '/tests', ]) ->withPhpSets(); --- tests/Mapping/AbstractClassMetadataFactoryTest.php | 4 ++-- tests/Mapping/RuntimeReflectionServiceTest.php | 6 ++++-- tests/Reflection/TypedNoDefaultReflectionPropertyTest.php | 2 +- tests/RuntimeReflectionPropertyTest.php | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/Mapping/AbstractClassMetadataFactoryTest.php b/tests/Mapping/AbstractClassMetadataFactoryTest.php index 080a054..d426c04 100644 --- a/tests/Mapping/AbstractClassMetadataFactoryTest.php +++ b/tests/Mapping/AbstractClassMetadataFactoryTest.php @@ -134,8 +134,8 @@ class TestAbstractClassMetadataFactory extends AbstractClassMetadataFactory /** @param ClassMetadata|null $defaultMetadata */ public function __construct( - private MappingDriver|null $driver = null, - private ClassMetadata|null $defaultMetadata = null, + private readonly MappingDriver|null $driver = null, + private readonly ClassMetadata|null $defaultMetadata = null, ) { } diff --git a/tests/Mapping/RuntimeReflectionServiceTest.php b/tests/Mapping/RuntimeReflectionServiceTest.php index c6e54b7..e8a7f3c 100644 --- a/tests/Mapping/RuntimeReflectionServiceTest.php +++ b/tests/Mapping/RuntimeReflectionServiceTest.php @@ -21,9 +21,11 @@ class RuntimeReflectionServiceTest extends TestCase public mixed $unusedPublicProperty; - private string $typedNoDefaultProperty; + /** @phpstan-ignore property.uninitializedReadonly */ + private readonly string $typedNoDefaultProperty; private string $typedDefaultProperty = ''; - private string $nonTypedNoDefaultProperty; // phpcs:ignore SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedProperty + /** @phpstan-ignore property.uninitializedReadonly */ + private readonly string $nonTypedNoDefaultProperty; // phpcs:ignore SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedProperty private string $nonTypedDefaultProperty = ''; // phpcs:ignore SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedProperty public string $typedNoDefaultPublicProperty; diff --git a/tests/Reflection/TypedNoDefaultReflectionPropertyTest.php b/tests/Reflection/TypedNoDefaultReflectionPropertyTest.php index 3b3f41e..244adff 100644 --- a/tests/Reflection/TypedNoDefaultReflectionPropertyTest.php +++ b/tests/Reflection/TypedNoDefaultReflectionPropertyTest.php @@ -72,7 +72,7 @@ class TypedFoo class TypedNullableFoo { - private string|null $value; + private string|null $value = null; public function setValue(mixed $value): void { diff --git a/tests/RuntimeReflectionPropertyTest.php b/tests/RuntimeReflectionPropertyTest.php index f88b546..18860e4 100644 --- a/tests/RuntimeReflectionPropertyTest.php +++ b/tests/RuntimeReflectionPropertyTest.php @@ -39,8 +39,8 @@ class RuntimeReflectionPropertyTest extends TestCase } /** @param class-string $proxyClass */ - #[TestWith(['Doctrine\\Tests\\Persistence\\RuntimeReflectionPropertyTestProxyMock'])] - #[TestWith(['\\Doctrine\\Tests\\Persistence\\RuntimeReflectionPropertyTestProxyMock'])] + #[TestWith([RuntimeReflectionPropertyTestProxyMock::class])] + #[TestWith([RuntimeReflectionPropertyTestProxyMock::class])] public function testGetValueOnProxyProperty(string $proxyClass): void { $getCheckMock = $this->createMock(DummyMock::class);