From 2bd2ac2cb7ddd879c231029d1476a3afeff3bf7e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:45:06 +0000 Subject: [PATCH 1/3] [TASK] Update eliashaeussler/rector-config to v3 | datasource | package | from | to | | ---------- | ---------------------------- | ----- | ----- | | packagist | eliashaeussler/rector-config | 2.0.1 | 3.0.0 | --- composer.json | 2 +- composer.lock | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index 4320484d..9a834791 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "require-dev": { "eliashaeussler/php-cs-fixer-config": "^2.0", "eliashaeussler/phpstan-config": "^2.0", - "eliashaeussler/rector-config": "^2.0", + "eliashaeussler/rector-config": "^3.0", "ergebnis/composer-normalize": "^2.21", "phpstan/extension-installer": "^1.2", "phpstan/phpstan-symfony": "^1.0", diff --git a/composer.lock b/composer.lock index f1ab3a2e..2a54ffca 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d05a3e96dd08b99b11648b10af8ea6aa", + "content-hash": "318630ab22706fa35f092188dda59b08", "packages": [ { "name": "nyholm/psr7", @@ -3804,22 +3804,22 @@ }, { "name": "eliashaeussler/rector-config", - "version": "2.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/eliashaeussler/rector-config.git", - "reference": "5a98a3bee2e67a7c4c3cb7acb7821e7edeaeda7e" + "reference": "b30a9aada8303eded433b07b82b988ec9bd63f76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/eliashaeussler/rector-config/zipball/5a98a3bee2e67a7c4c3cb7acb7821e7edeaeda7e", - "reference": "5a98a3bee2e67a7c4c3cb7acb7821e7edeaeda7e", + "url": "https://api.github.com/repos/eliashaeussler/rector-config/zipball/b30a9aada8303eded433b07b82b988ec9bd63f76", + "reference": "b30a9aada8303eded433b07b82b988ec9bd63f76", "shasum": "" }, "require": { "composer-runtime-api": "^2.0", "php": "~8.1.0 || ~8.2.0 || ~8.3.0", - "rector/rector": "^0.15.21 || ^0.16.0 || ^0.17.0 || ^0.18.0" + "rector/rector": "^1.0" }, "require-dev": { "armin/editorconfig-cli": "^1.8 || ^2.0", @@ -3827,15 +3827,15 @@ "eliashaeussler/php-cs-fixer-config": "^2.0", "eliashaeussler/phpstan-config": "^2.0", "ergebnis/composer-normalize": "^2.30", + "illuminate/container": "^10.39", "phpstan/extension-installer": "^1.2", "phpunit/phpunit": "^10.1", - "ssch/typo3-rector": "^1.2", + "ssch/typo3-rector": "^2.0", "symfony/config": "^5.4 || ^6.0 || ^7.0", - "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", - "typo3/cms-core": "^12.4" + "typo3/cms-core": "^12.4 || ^13.0" }, "suggest": { - "ssch/typo3-rector": "Configures additional Rector rules for TYPO3 CMS projects" + "ssch/typo3-rector": "Configures additional Rector rules for TYPO3 CMS projects (^2.0)" }, "type": "library", "autoload": { @@ -3858,9 +3858,9 @@ "description": "My personal configuration for Rector", "support": { "issues": "https://github.com/eliashaeussler/rector-config/issues", - "source": "https://github.com/eliashaeussler/rector-config/tree/2.0.1" + "source": "https://github.com/eliashaeussler/rector-config/tree/3.0.0" }, - "time": "2024-01-19T10:03:24+00:00" + "time": "2024-02-12T15:19:55+00:00" }, { "name": "ergebnis/composer-normalize", @@ -4833,16 +4833,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.54", + "version": "1.10.58", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "3e25f279dada0adc14ffd7bad09af2e2fc3523bb" + "reference": "a23518379ec4defd9e47cbf81019526861623ec2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3e25f279dada0adc14ffd7bad09af2e2fc3523bb", - "reference": "3e25f279dada0adc14ffd7bad09af2e2fc3523bb", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a23518379ec4defd9e47cbf81019526861623ec2", + "reference": "a23518379ec4defd9e47cbf81019526861623ec2", "shasum": "" }, "require": { @@ -4891,7 +4891,7 @@ "type": "tidelift" } ], - "time": "2024-01-05T15:50:47+00:00" + "time": "2024-02-12T20:02:57+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -5486,21 +5486,21 @@ }, { "name": "rector/rector", - "version": "0.18.13", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "f8011a76d36aa4f839f60f3b4f97707d97176618" + "reference": "362258a1f6369fc88d02d469a5478d220f78b0e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/f8011a76d36aa4f839f60f3b4f97707d97176618", - "reference": "f8011a76d36aa4f839f60f3b4f97707d97176618", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/362258a1f6369fc88d02d469a5478d220f78b0e6", + "reference": "362258a1f6369fc88d02d469a5478d220f78b0e6", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.35" + "phpstan/phpstan": "^1.10.56" }, "conflict": { "rector/rector-doctrine": "*", @@ -5530,7 +5530,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.18.13" + "source": "https://github.com/rectorphp/rector/tree/1.0.0" }, "funding": [ { @@ -5538,7 +5538,7 @@ "type": "github" } ], - "time": "2023-12-20T16:08:01+00:00" + "time": "2024-02-06T13:38:07+00:00" }, { "name": "sebastian/cli-parser", From 2382b9a59f8ab2de063c6531c9169aded368aaf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=A4u=C3=9Fler?= Date: Wed, 14 Feb 2024 18:29:39 +0100 Subject: [PATCH 2/3] [TASK] Add #[Override] annotations --- src/Badge/Provider/BadgenBadgeProvider.php | 8 ++++++++ src/Badge/Provider/ShieldsBadgeProvider.php | 8 ++++++++ src/Cache/RandomExtensionMetadataCacheWarmer.php | 3 +++ src/Entity/Dto/ExtensionMetadata.php | 5 +++++ 4 files changed, 24 insertions(+) diff --git a/src/Badge/Provider/BadgenBadgeProvider.php b/src/Badge/Provider/BadgenBadgeProvider.php index 7f22822d..16cca5fb 100644 --- a/src/Badge/Provider/BadgenBadgeProvider.php +++ b/src/Badge/Provider/BadgenBadgeProvider.php @@ -26,6 +26,7 @@ use App\Entity\Badge; use App\Enums\Color; use Nyholm\Psr7\Uri; +use Override; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; @@ -55,16 +56,19 @@ public function __construct( $this->router = $router; } + #[Override] public static function getIdentifier(): string { return self::IDENTIFIER; } + #[Override] public static function getName(): string { return 'Badgen'; } + #[Override] public function createResponse(Badge $badge): Response { return new JsonResponse([ @@ -74,6 +78,7 @@ public function createResponse(Badge $badge): Response ]); } + #[Override] public function generateUriForRoute(Route|string $route, array $routeParameters = []): string { // Enforce provider parameter @@ -93,6 +98,7 @@ public function generateUriForRoute(Route|string $route, array $routeParameters ]); } + #[Override] public function generateUriForBadge(Badge $badge): string { $urlParameters = [ @@ -107,11 +113,13 @@ public function generateUriForBadge(Badge $badge): string /** * @codeCoverageIgnore */ + #[Override] public function getUrlPattern(): string { return self::ENDPOINT_URL_PATTERN; } + #[Override] public function getProviderUrl(): string { return 'https://badgen.net'; diff --git a/src/Badge/Provider/ShieldsBadgeProvider.php b/src/Badge/Provider/ShieldsBadgeProvider.php index 0ef0141a..37e56848 100644 --- a/src/Badge/Provider/ShieldsBadgeProvider.php +++ b/src/Badge/Provider/ShieldsBadgeProvider.php @@ -25,6 +25,7 @@ use App\Entity\Badge; use App\Enums\Color; +use Override; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; @@ -54,16 +55,19 @@ public function __construct( $this->router = $router; } + #[Override] public static function getIdentifier(): string { return self::IDENTIFIER; } + #[Override] public static function getName(): string { return 'Shields.io'; } + #[Override] public function createResponse(Badge $badge): Response { return new JsonResponse([ @@ -76,6 +80,7 @@ public function createResponse(Badge $badge): Response ]); } + #[Override] public function generateUriForRoute(Route|string $route, array $routeParameters = []): string { // Enforce provider parameter @@ -94,6 +99,7 @@ public function generateUriForRoute(Route|string $route, array $routeParameters ]); } + #[Override] public function generateUriForBadge(Badge $badge): string { $urlParameters = [ @@ -109,11 +115,13 @@ public function generateUriForBadge(Badge $badge): string /** * @codeCoverageIgnore */ + #[Override] public function getUrlPattern(): string { return self::ENDPOINT_URL_PATTERN; } + #[Override] public function getProviderUrl(): string { return 'https://shields.io'; diff --git a/src/Cache/RandomExtensionMetadataCacheWarmer.php b/src/Cache/RandomExtensionMetadataCacheWarmer.php index edd85abc..4a46748f 100644 --- a/src/Cache/RandomExtensionMetadataCacheWarmer.php +++ b/src/Cache/RandomExtensionMetadataCacheWarmer.php @@ -24,6 +24,7 @@ namespace App\Cache; use App\Service\ApiService; +use Override; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; /** @@ -42,6 +43,7 @@ public function __construct( private ApiService $apiService, ) {} + #[Override] public function warmUp(string $cacheDir, ?string $buildDir = null): array { $this->apiService->getRandomExtensionMetadata(); @@ -49,6 +51,7 @@ public function warmUp(string $cacheDir, ?string $buildDir = null): array return []; } + #[Override] public function isOptional(): bool { return true; diff --git a/src/Entity/Dto/ExtensionMetadata.php b/src/Entity/Dto/ExtensionMetadata.php index d2eccedf..61da740d 100644 --- a/src/Entity/Dto/ExtensionMetadata.php +++ b/src/Entity/Dto/ExtensionMetadata.php @@ -25,6 +25,7 @@ use ArrayAccess; use DateTime; +use Override; /** * ExtensionMetadata. @@ -57,21 +58,25 @@ public function getExpiryDate(): ?DateTime return $this->expiryDate; } + #[Override] public function offsetExists(mixed $offset): bool { return isset($this->metadata[$offset]); } + #[Override] public function offsetGet(mixed $offset): mixed { return $this->metadata[$offset] ?? null; } + #[Override] public function offsetSet(mixed $offset, mixed $value): void { $this->metadata[$offset] = $value; } + #[Override] public function offsetUnset(mixed $offset): void { unset($this->metadata[$offset]); From c15af1be5fe3ddbcb556a3f798239c05b810ec12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=A4u=C3=9Fler?= Date: Wed, 14 Feb 2024 18:29:52 +0100 Subject: [PATCH 3/3] [TASK] Run Rector migration --- tests/ClearCacheAfterTestExtension.php | 3 +++ tests/Entity/Dto/ExtensionMetadataTest.php | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/ClearCacheAfterTestExtension.php b/tests/ClearCacheAfterTestExtension.php index 214f980f..03bc6391 100644 --- a/tests/ClearCacheAfterTestExtension.php +++ b/tests/ClearCacheAfterTestExtension.php @@ -23,6 +23,7 @@ namespace App\Tests; +use Override; use PHPUnit\Event\Test\Finished; use PHPUnit\Event\Test\FinishedSubscriber; use PHPUnit\Runner\Extension\Extension; @@ -39,11 +40,13 @@ */ final class ClearCacheAfterTestExtension implements Extension, FinishedSubscriber { + #[Override] public function bootstrap(Configuration $configuration, Facade $facade, ParameterCollection $parameters): void { $facade->registerSubscriber($this); } + #[Override] public function notify(Finished $event): void { (new Filesystem())->remove(__DIR__.'/../var/cache/test'); diff --git a/tests/Entity/Dto/ExtensionMetadataTest.php b/tests/Entity/Dto/ExtensionMetadataTest.php index 0346506b..0d8834f4 100644 --- a/tests/Entity/Dto/ExtensionMetadataTest.php +++ b/tests/Entity/Dto/ExtensionMetadataTest.php @@ -63,8 +63,8 @@ public function getExpiryDateReturnsExpiryDate(): void public function subjectCanBeAccessedAsArray(): void { // offsetExists() - self::assertTrue(isset($this->subject['foo'])); - self::assertFalse(isset($this->subject['baz'])); + self::assertArrayHasKey('foo', $this->subject); + self::assertArrayNotHasKey('baz', $this->subject); // offsetGet() self::assertSame('baz', $this->subject['foo']); @@ -76,6 +76,6 @@ public function subjectCanBeAccessedAsArray(): void // offsetUnset() unset($this->subject['baz']); - self::assertFalse(isset($this->subject['baz'])); + self::assertArrayNotHasKey('baz', $this->subject); } }