Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Update eliashaeussler/rector-config to v3 #791

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
48 changes: 24 additions & 24 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/Badge/Provider/BadgenBadgeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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([
Expand All @@ -74,6 +78,7 @@ public function createResponse(Badge $badge): Response
]);
}

#[Override]
public function generateUriForRoute(Route|string $route, array $routeParameters = []): string
{
// Enforce provider parameter
Expand All @@ -93,6 +98,7 @@ public function generateUriForRoute(Route|string $route, array $routeParameters
]);
}

#[Override]
public function generateUriForBadge(Badge $badge): string
{
$urlParameters = [
Expand All @@ -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';
Expand Down
8 changes: 8 additions & 0 deletions src/Badge/Provider/ShieldsBadgeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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([
Expand All @@ -76,6 +80,7 @@ public function createResponse(Badge $badge): Response
]);
}

#[Override]
public function generateUriForRoute(Route|string $route, array $routeParameters = []): string
{
// Enforce provider parameter
Expand All @@ -94,6 +99,7 @@ public function generateUriForRoute(Route|string $route, array $routeParameters
]);
}

#[Override]
public function generateUriForBadge(Badge $badge): string
{
$urlParameters = [
Expand All @@ -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';
Expand Down
3 changes: 3 additions & 0 deletions src/Cache/RandomExtensionMetadataCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
namespace App\Cache;

use App\Service\ApiService;
use Override;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;

/**
Expand All @@ -42,13 +43,15 @@ public function __construct(
private ApiService $apiService,
) {}

#[Override]
public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
$this->apiService->getRandomExtensionMetadata();

return [];
}

#[Override]
public function isOptional(): bool
{
return true;
Expand Down
5 changes: 5 additions & 0 deletions src/Entity/Dto/ExtensionMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

use ArrayAccess;
use DateTime;
use Override;

/**
* ExtensionMetadata.
Expand Down Expand Up @@ -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]);
Expand Down
3 changes: 3 additions & 0 deletions tests/ClearCacheAfterTestExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace App\Tests;

use Override;
use PHPUnit\Event\Test\Finished;
use PHPUnit\Event\Test\FinishedSubscriber;
use PHPUnit\Runner\Extension\Extension;
Expand All @@ -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');
Expand Down
6 changes: 3 additions & 3 deletions tests/Entity/Dto/ExtensionMetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -76,6 +76,6 @@ public function subjectCanBeAccessedAsArray(): void

// offsetUnset()
unset($this->subject['baz']);
self::assertFalse(isset($this->subject['baz']));
self::assertArrayNotHasKey('baz', $this->subject);
}
}
Loading