Use Rector on tests

This is the configuration I used:

	<?php

	declare(strict_types=1);

	use Rector\Config\RectorConfig;

	return RectorConfig::configure()
	    ->withPaths([
		__DIR__ . '/tests',
	    ])
	    ->withPhpSets();
This commit is contained in:
Grégoire Paris
2026-01-24 11:46:27 +01:00
parent abd2c9ed1c
commit 7e82b02509
4 changed files with 9 additions and 7 deletions

View File

@@ -134,8 +134,8 @@ class TestAbstractClassMetadataFactory extends AbstractClassMetadataFactory
/** @param ClassMetadata<object>|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,
) {
}

View File

@@ -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;

View File

@@ -72,7 +72,7 @@ class TypedFoo
class TypedNullableFoo
{
private string|null $value;
private string|null $value = null;
public function setValue(mixed $value): void
{

View File

@@ -39,8 +39,8 @@ class RuntimeReflectionPropertyTest extends TestCase
}
/** @param class-string<RuntimeReflectionPropertyTestProxyMock> $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);