From 446b069f8b16a256cec42556cf364d75908fdce6 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sat, 7 Dec 2024 15:36:15 +0000 Subject: [PATCH 1/5] DevKit updates --- .github/workflows/test.yaml | 20 +++++++------------- rector.php | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ace14913..fcb429c8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,7 +30,6 @@ jobs: strategy: matrix: php-version: - - '8.0' - '8.1' - '8.2' - '8.3' @@ -39,30 +38,25 @@ jobs: symfony-require: [''] variant: [normal] include: - - php-version: '8.0' + - php-version: '8.1' dependencies: lowest allowed-to-fail: false variant: normal - php-version: '8.3' dependencies: highest allowed-to-fail: false - symfony-require: 5.4.* - variant: symfony/symfony:"5.4.*" - - php-version: '8.3' - dependencies: highest - allowed-to-fail: false - symfony-require: 6.3.* - variant: symfony/symfony:"6.3.*" + symfony-require: 6.4.* + variant: symfony/symfony:"6.4.*" - php-version: '8.3' dependencies: highest allowed-to-fail: false - symfony-require: 6.4.* - variant: symfony/symfony:"6.4.*" + symfony-require: 7.1.* + variant: symfony/symfony:"7.1.*" - php-version: '8.3' dependencies: highest allowed-to-fail: false - symfony-require: 7.0.* - variant: symfony/symfony:"7.0.*" + symfony-require: 7.2.* + variant: symfony/symfony:"7.2.*" steps: - name: Checkout diff --git a/rector.php b/rector.php index 74463238..d57c8f49 100644 --- a/rector.php +++ b/rector.php @@ -31,7 +31,7 @@ ]); $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_80, + LevelSetList::UP_TO_PHP_81, PHPUnitSetList::PHPUNIT_90, PHPUnitSetList::PHPUNIT_CODE_QUALITY, ]); From d67bafb8877941744eb7dc2b1cb64405be6cb94c Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sat, 7 Dec 2024 17:54:17 +0100 Subject: [PATCH 2/5] Drop old versions of PHP and Symfony (#640) * Drop old versions * Run rector --- composer.json | 28 +++++++++---------- src/Action/CompareAction.php | 4 +-- src/Action/IndexAction.php | 4 +-- src/Action/ViewDetailAction.php | 4 +-- src/Action/ViewEntityAction.php | 4 +-- src/Action/ViewRevisionAction.php | 4 +-- src/AuditManager.php | 6 ++-- src/ChangedEntity.php | 8 +++--- ...angedManyToManyEntityRevisionToPersist.php | 12 ++++---- src/EventListener/CacheListener.php | 2 +- src/Revision.php | 4 +-- tests/ClockTest.php | 2 +- 12 files changed, 41 insertions(+), 41 deletions(-) diff --git a/composer.json b/composer.json index 3c14bf30..fbcbe56f 100644 --- a/composer.json +++ b/composer.json @@ -9,17 +9,17 @@ "Audit" ], "require": { - "php": "^8.0", + "php": "^8.1", "doctrine/collections": "^1.8 || ^2.0", "doctrine/dbal": "^3.6", "doctrine/event-manager": "^1.2 || ^2.0", "doctrine/orm": "^2.14 || ^3.0", "doctrine/persistence": "^3.0", "psr/clock": "^1.0", - "symfony/config": "^5.4 || ^6.2 || ^7.0", - "symfony/dependency-injection": "^5.4 || ^6.2 || ^7.0", - "symfony/http-kernel": "^5.4 || ^6.2 || ^7.0", - "symfony/security-core": "^5.4 || ^6.2 || ^7.0", + "symfony/config": "^6.4 || ^7.1", + "symfony/dependency-injection": "^6.4 || ^7.1", + "symfony/http-kernel": "^6.4 || ^7.1", + "symfony/security-core": "^6.4 || ^7.1", "twig/twig": "^3.0" }, "require-dev": { @@ -38,15 +38,15 @@ "psalm/plugin-phpunit": "^0.18", "psalm/plugin-symfony": "^5.0", "rector/rector": "^1.1", - "symfony/browser-kit": "^5.4 || ^6.2 || ^7.0", - "symfony/cache": "^5.4 || ^6.2 || ^7.0", - "symfony/filesystem": "^5.4 || ^6.2 || ^7.0", - "symfony/framework-bundle": "^5.4 || ^6.2 || ^7.0", - "symfony/http-foundation": "^5.4 || ^6.2 || ^7.0", - "symfony/phpunit-bridge": "^6.2", - "symfony/security-bundle": "^5.4 || ^6.2 || ^7.0", - "symfony/twig-bundle": "^5.4 || ^6.2 || ^7.0", - "symfony/var-dumper": "^5.4 || ^6.2 || ^7.0", + "symfony/browser-kit": "^6.4 || ^7.1", + "symfony/cache": "^6.4 || ^7.1", + "symfony/filesystem": "^6.4 || ^7.1", + "symfony/framework-bundle": "^6.4 || ^7.1", + "symfony/http-foundation": "^6.4 || ^7.1", + "symfony/phpunit-bridge": "^6.4 || ^7.1", + "symfony/security-bundle": "^6.4 || ^7.1", + "symfony/twig-bundle": "^6.4 || ^7.1", + "symfony/var-dumper": "^6.4 || ^7.1", "vimeo/psalm": "^5.7" }, "conflict": { diff --git a/src/Action/CompareAction.php b/src/Action/CompareAction.php index 4041fd5f..5c82e8ed 100644 --- a/src/Action/CompareAction.php +++ b/src/Action/CompareAction.php @@ -21,8 +21,8 @@ final class CompareAction { public function __construct( - private Environment $twig, - private AuditReader $auditReader, + private readonly Environment $twig, + private readonly AuditReader $auditReader, ) { } diff --git a/src/Action/IndexAction.php b/src/Action/IndexAction.php index 0cc119f1..d2d7b11a 100644 --- a/src/Action/IndexAction.php +++ b/src/Action/IndexAction.php @@ -20,8 +20,8 @@ final class IndexAction { public function __construct( - private Environment $twig, - private AuditReader $auditReader, + private readonly Environment $twig, + private readonly AuditReader $auditReader, ) { } diff --git a/src/Action/ViewDetailAction.php b/src/Action/ViewDetailAction.php index 3cdc0437..777c53fc 100644 --- a/src/Action/ViewDetailAction.php +++ b/src/Action/ViewDetailAction.php @@ -21,8 +21,8 @@ final class ViewDetailAction { public function __construct( - private Environment $twig, - private AuditReader $auditReader, + private readonly Environment $twig, + private readonly AuditReader $auditReader, ) { } diff --git a/src/Action/ViewEntityAction.php b/src/Action/ViewEntityAction.php index da2bf386..c80f5eb7 100644 --- a/src/Action/ViewEntityAction.php +++ b/src/Action/ViewEntityAction.php @@ -20,8 +20,8 @@ final class ViewEntityAction { public function __construct( - private Environment $twig, - private AuditReader $auditReader, + private readonly Environment $twig, + private readonly AuditReader $auditReader, ) { } diff --git a/src/Action/ViewRevisionAction.php b/src/Action/ViewRevisionAction.php index a9102e97..5f4c168c 100644 --- a/src/Action/ViewRevisionAction.php +++ b/src/Action/ViewRevisionAction.php @@ -22,8 +22,8 @@ final class ViewRevisionAction { public function __construct( - private Environment $twig, - private AuditReader $auditReader, + private readonly Environment $twig, + private readonly AuditReader $auditReader, ) { } diff --git a/src/AuditManager.php b/src/AuditManager.php index 98b88f33..0acf0a33 100644 --- a/src/AuditManager.php +++ b/src/AuditManager.php @@ -26,11 +26,11 @@ */ class AuditManager { - private MetadataFactory $metadataFactory; + private readonly MetadataFactory $metadataFactory; public function __construct( - private AuditConfiguration $config, - private ?ClockInterface $clock = null, + private readonly AuditConfiguration $config, + private readonly ?ClockInterface $clock = null, ) { $this->metadataFactory = $config->createMetadataFactory(); } diff --git a/src/ChangedEntity.php b/src/ChangedEntity.php index f48e04ba..a5061ac3 100644 --- a/src/ChangedEntity.php +++ b/src/ChangedEntity.php @@ -25,10 +25,10 @@ class ChangedEntity * @phpstan-param T $entity */ public function __construct( - private string $className, - private array $id, - private string $revType, - private object $entity, + private readonly string $className, + private readonly array $id, + private readonly string $revType, + private readonly object $entity, ) { } diff --git a/src/DeferredChangedManyToManyEntityRevisionToPersist.php b/src/DeferredChangedManyToManyEntityRevisionToPersist.php index 56eac1cc..5e4f008a 100644 --- a/src/DeferredChangedManyToManyEntityRevisionToPersist.php +++ b/src/DeferredChangedManyToManyEntityRevisionToPersist.php @@ -28,12 +28,12 @@ final class DeferredChangedManyToManyEntityRevisionToPersist * @param ClassMetadata $targetClass */ public function __construct( - private object $entity, - private string $revType, - private array $entityData, - private array|ManyToManyOwningSideMapping $assoc, - private ClassMetadata $class, - private ClassMetadata $targetClass, + private readonly object $entity, + private readonly string $revType, + private readonly array $entityData, + private readonly array|ManyToManyOwningSideMapping $assoc, + private readonly ClassMetadata $class, + private readonly ClassMetadata $targetClass, ) { } diff --git a/src/EventListener/CacheListener.php b/src/EventListener/CacheListener.php index ff0b218d..5745db3f 100644 --- a/src/EventListener/CacheListener.php +++ b/src/EventListener/CacheListener.php @@ -22,7 +22,7 @@ */ final class CacheListener implements EventSubscriber { - public function __construct(private AuditReader $auditReader) + public function __construct(private readonly AuditReader $auditReader) { } diff --git a/src/Revision.php b/src/Revision.php index ad42d3e9..eda368a5 100644 --- a/src/Revision.php +++ b/src/Revision.php @@ -23,8 +23,8 @@ class Revision */ public function __construct( private $rev, - private \DateTime $timestamp, - private ?string $username, + private readonly \DateTime $timestamp, + private readonly ?string $username, ) { } diff --git a/tests/ClockTest.php b/tests/ClockTest.php index 22cb02e6..3e6feebc 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -50,7 +50,7 @@ public function testFixedClockIsUsed(): void protected function getClock(): ClockInterface { return new class($this->getFixedTime()) implements ClockInterface { - public function __construct(private \DateTimeImmutable $now) + public function __construct(private readonly \DateTimeImmutable $now) { } From 669f0c2fd5ddd854160c6f58df3eb3095e49cb77 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sat, 7 Dec 2024 17:10:52 +0000 Subject: [PATCH 3/5] DevKit updates --- rector.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rector.php b/rector.php index d57c8f49..295ccef6 100644 --- a/rector.php +++ b/rector.php @@ -19,6 +19,7 @@ use Rector\Config\RectorConfig; use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector; +use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; use Rector\PHPUnit\Set\PHPUnitSetList; @@ -40,6 +41,7 @@ $rectorConfig->importShortClasses(false); $rectorConfig->skip([ ExceptionHandlerTypehintRector::class, + ReadOnlyPropertyRector::class, PreferPHPUnitThisCallRector::class, NarrowUnusedSetUpDefinedPropertyRector::class, ]); From 289f249afaf3ce514a331aff6c7571adae0fbd5f Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sat, 7 Dec 2024 18:28:03 +0100 Subject: [PATCH 4/5] Revert readonly properties (#642) * Revert "Drop old versions of PHP and Symfony (#640)" This reverts commit d67bafb8877941744eb7dc2b1cb64405be6cb94c. * Bump deps --- src/Action/CompareAction.php | 4 ++-- src/Action/IndexAction.php | 4 ++-- src/Action/ViewDetailAction.php | 4 ++-- src/Action/ViewEntityAction.php | 4 ++-- src/Action/ViewRevisionAction.php | 4 ++-- src/AuditManager.php | 6 +++--- src/ChangedEntity.php | 8 ++++---- ...erredChangedManyToManyEntityRevisionToPersist.php | 12 ++++++------ src/EventListener/CacheListener.php | 2 +- src/Revision.php | 4 ++-- tests/ClockTest.php | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Action/CompareAction.php b/src/Action/CompareAction.php index 5c82e8ed..4041fd5f 100644 --- a/src/Action/CompareAction.php +++ b/src/Action/CompareAction.php @@ -21,8 +21,8 @@ final class CompareAction { public function __construct( - private readonly Environment $twig, - private readonly AuditReader $auditReader, + private Environment $twig, + private AuditReader $auditReader, ) { } diff --git a/src/Action/IndexAction.php b/src/Action/IndexAction.php index d2d7b11a..0cc119f1 100644 --- a/src/Action/IndexAction.php +++ b/src/Action/IndexAction.php @@ -20,8 +20,8 @@ final class IndexAction { public function __construct( - private readonly Environment $twig, - private readonly AuditReader $auditReader, + private Environment $twig, + private AuditReader $auditReader, ) { } diff --git a/src/Action/ViewDetailAction.php b/src/Action/ViewDetailAction.php index 777c53fc..3cdc0437 100644 --- a/src/Action/ViewDetailAction.php +++ b/src/Action/ViewDetailAction.php @@ -21,8 +21,8 @@ final class ViewDetailAction { public function __construct( - private readonly Environment $twig, - private readonly AuditReader $auditReader, + private Environment $twig, + private AuditReader $auditReader, ) { } diff --git a/src/Action/ViewEntityAction.php b/src/Action/ViewEntityAction.php index c80f5eb7..da2bf386 100644 --- a/src/Action/ViewEntityAction.php +++ b/src/Action/ViewEntityAction.php @@ -20,8 +20,8 @@ final class ViewEntityAction { public function __construct( - private readonly Environment $twig, - private readonly AuditReader $auditReader, + private Environment $twig, + private AuditReader $auditReader, ) { } diff --git a/src/Action/ViewRevisionAction.php b/src/Action/ViewRevisionAction.php index 5f4c168c..a9102e97 100644 --- a/src/Action/ViewRevisionAction.php +++ b/src/Action/ViewRevisionAction.php @@ -22,8 +22,8 @@ final class ViewRevisionAction { public function __construct( - private readonly Environment $twig, - private readonly AuditReader $auditReader, + private Environment $twig, + private AuditReader $auditReader, ) { } diff --git a/src/AuditManager.php b/src/AuditManager.php index 0acf0a33..98b88f33 100644 --- a/src/AuditManager.php +++ b/src/AuditManager.php @@ -26,11 +26,11 @@ */ class AuditManager { - private readonly MetadataFactory $metadataFactory; + private MetadataFactory $metadataFactory; public function __construct( - private readonly AuditConfiguration $config, - private readonly ?ClockInterface $clock = null, + private AuditConfiguration $config, + private ?ClockInterface $clock = null, ) { $this->metadataFactory = $config->createMetadataFactory(); } diff --git a/src/ChangedEntity.php b/src/ChangedEntity.php index a5061ac3..f48e04ba 100644 --- a/src/ChangedEntity.php +++ b/src/ChangedEntity.php @@ -25,10 +25,10 @@ class ChangedEntity * @phpstan-param T $entity */ public function __construct( - private readonly string $className, - private readonly array $id, - private readonly string $revType, - private readonly object $entity, + private string $className, + private array $id, + private string $revType, + private object $entity, ) { } diff --git a/src/DeferredChangedManyToManyEntityRevisionToPersist.php b/src/DeferredChangedManyToManyEntityRevisionToPersist.php index 5e4f008a..56eac1cc 100644 --- a/src/DeferredChangedManyToManyEntityRevisionToPersist.php +++ b/src/DeferredChangedManyToManyEntityRevisionToPersist.php @@ -28,12 +28,12 @@ final class DeferredChangedManyToManyEntityRevisionToPersist * @param ClassMetadata $targetClass */ public function __construct( - private readonly object $entity, - private readonly string $revType, - private readonly array $entityData, - private readonly array|ManyToManyOwningSideMapping $assoc, - private readonly ClassMetadata $class, - private readonly ClassMetadata $targetClass, + private object $entity, + private string $revType, + private array $entityData, + private array|ManyToManyOwningSideMapping $assoc, + private ClassMetadata $class, + private ClassMetadata $targetClass, ) { } diff --git a/src/EventListener/CacheListener.php b/src/EventListener/CacheListener.php index 5745db3f..ff0b218d 100644 --- a/src/EventListener/CacheListener.php +++ b/src/EventListener/CacheListener.php @@ -22,7 +22,7 @@ */ final class CacheListener implements EventSubscriber { - public function __construct(private readonly AuditReader $auditReader) + public function __construct(private AuditReader $auditReader) { } diff --git a/src/Revision.php b/src/Revision.php index eda368a5..ad42d3e9 100644 --- a/src/Revision.php +++ b/src/Revision.php @@ -23,8 +23,8 @@ class Revision */ public function __construct( private $rev, - private readonly \DateTime $timestamp, - private readonly ?string $username, + private \DateTime $timestamp, + private ?string $username, ) { } diff --git a/tests/ClockTest.php b/tests/ClockTest.php index 3e6feebc..22cb02e6 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -50,7 +50,7 @@ public function testFixedClockIsUsed(): void protected function getClock(): ClockInterface { return new class($this->getFixedTime()) implements ClockInterface { - public function __construct(private readonly \DateTimeImmutable $now) + public function __construct(private \DateTimeImmutable $now) { } From b7a53d0dd2d8bebed07d523da465b09cd3596af0 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sat, 7 Dec 2024 18:23:12 +0000 Subject: [PATCH 5/5] DevKit updates --- rector.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rector.php b/rector.php index 295ccef6..254341a3 100644 --- a/rector.php +++ b/rector.php @@ -19,6 +19,7 @@ use Rector\Config\RectorConfig; use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector; +use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; @@ -42,6 +43,7 @@ $rectorConfig->skip([ ExceptionHandlerTypehintRector::class, ReadOnlyPropertyRector::class, + NullToStrictStringFuncCallArgRector::class, PreferPHPUnitThisCallRector::class, NarrowUnusedSetUpDefinedPropertyRector::class, ]);