diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 5163580..75fe030 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -7,7 +7,7 @@ jobs: name: Audit strategy: matrix: - php-version: [ '8.1', '8.2', '8.3' ] + php-version: [ '8.2', '8.3' ] fail-fast: false runs-on: ubuntu-latest steps: diff --git a/composer.json b/composer.json index d96c264..cf93b53 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "ext-filter": "*", "ext-hash": "*", "ext-json": "*", @@ -24,25 +24,25 @@ "psr/cache": "^3", "psr/log": "^3", "snc/redis-bundle": "^4.5", - "symfony/cache": "^6.4", + "symfony/cache": "^7", "symfony/cache-contracts": "^3", - "symfony/config": "^6.4", - "symfony/console": "^6.4", - "symfony/dependency-injection": "^6.4", - "symfony/error-handler": "^6.4", - "symfony/event-dispatcher": "^6.4", + "symfony/config": "^7", + "symfony/console": "^7", + "symfony/dependency-injection": "^7", + "symfony/error-handler": "^7", + "symfony/event-dispatcher": "^7", "symfony/event-dispatcher-contracts": "^3", - "symfony/expression-language": "^6.4", - "symfony/framework-bundle": "^6.4", - "symfony/http-client": "^6.4", + "symfony/expression-language": "^7", + "symfony/framework-bundle": "^7", + "symfony/http-client": "^7", "symfony/http-client-contracts": "^3", - "symfony/http-foundation": "^6.4", - "symfony/http-kernel": "^6.4", - "symfony/routing": "^6.4", - "symfony/security-bundle": "^6.4", - "symfony/security-core": "^6.4", - "symfony/security-http": "^6.4", - "symfony/uid": "^6.4", + "symfony/http-foundation": "^7", + "symfony/http-kernel": "^7", + "symfony/routing": "^7", + "symfony/security-bundle": "^7", + "symfony/security-core": "^7", + "symfony/security-http": "^7", + "symfony/uid": "^7", "web-token/jwt-framework": "^3.2" }, "require-dev": { @@ -51,16 +51,7 @@ "psr/event-dispatcher": "^1", "psr/event-dispatcher-implementation": "1.0", "roave/security-advisories": "dev-latest", - "symfony/clock": "^6.4", - "symfony/filesystem": "^6.4", - "symfony/finder": "^6.4", - "symfony/password-hasher": "^6.4", - "symfony/phpunit-bridge": "^6.4", - "symfony/property-access": "^6.4", - "symfony/property-info": "^6.4", - "symfony/security-csrf": "^6.4", - "symfony/string": "^6.4", - "symfony/var-exporter": "^6.4" + "symfony/phpunit-bridge": "^7" }, "repositories": [ { diff --git a/src/Bundles/JsonFetcher/DependencyInjection/Configuration.php b/src/Bundles/JsonFetcher/DependencyInjection/Configuration.php index 8bcb511..8704978 100644 --- a/src/Bundles/JsonFetcher/DependencyInjection/Configuration.php +++ b/src/Bundles/JsonFetcher/DependencyInjection/Configuration.php @@ -14,7 +14,7 @@ class Configuration implements ConfigurationInterface { /** - * @suppress PhanPossiblyNonClassMethodCall, PhanPossiblyUndeclaredMethod + * @suppress PhanPossiblyUndeclaredMethod */ public function getConfigTreeBuilder(): TreeBuilder { diff --git a/src/Bundles/JsonFetcher/FeatureConfig/JsonFetcherConfigFactory.php b/src/Bundles/JsonFetcher/FeatureConfig/JsonFetcherConfigFactory.php index 09da77e..3388e2e 100644 --- a/src/Bundles/JsonFetcher/FeatureConfig/JsonFetcherConfigFactory.php +++ b/src/Bundles/JsonFetcher/FeatureConfig/JsonFetcherConfigFactory.php @@ -7,10 +7,10 @@ use SingleA\Contracts\PayloadFetcher\FetcherConfigFactoryInterface; -final class JsonFetcherConfigFactory implements FetcherConfigFactoryInterface +final readonly class JsonFetcherConfigFactory implements FetcherConfigFactoryInterface { public function __construct( - private readonly bool $httpsOnly, + private bool $httpsOnly, ) {} public function getConfigClass(): string diff --git a/src/Bundles/JsonFetcher/JsonFetcher.php b/src/Bundles/JsonFetcher/JsonFetcher.php index 195dd68..7465804 100644 --- a/src/Bundles/JsonFetcher/JsonFetcher.php +++ b/src/Bundles/JsonFetcher/JsonFetcher.php @@ -10,10 +10,10 @@ use SingleA\Contracts\PayloadFetcher\FetcherInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; -final class JsonFetcher implements FetcherInterface +final readonly class JsonFetcher implements FetcherInterface { public function __construct( - private readonly HttpClientInterface $httpClient, + private HttpClientInterface $httpClient, ) {} public function supports(FetcherConfigInterface|string $config): bool diff --git a/src/Bundles/JsonFetcher/SingleaJsonFetcherBundle.php b/src/Bundles/JsonFetcher/SingleaJsonFetcherBundle.php index 61c46a4..7fe5fc3 100644 --- a/src/Bundles/JsonFetcher/SingleaJsonFetcherBundle.php +++ b/src/Bundles/JsonFetcher/SingleaJsonFetcherBundle.php @@ -9,5 +9,7 @@ /** * @final + * + * @psalm-suppress MissingConstructor */ class SingleaJsonFetcherBundle extends Bundle {} diff --git a/src/Bundles/JsonFetcher/composer.json b/src/Bundles/JsonFetcher/composer.json index 9ac55b1..9383bdf 100644 --- a/src/Bundles/JsonFetcher/composer.json +++ b/src/Bundles/JsonFetcher/composer.json @@ -10,13 +10,13 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "nbgrp/singlea-payload-fetcher-contracts": "^1", - "symfony/config": "^6.4", - "symfony/dependency-injection": "^6.4", + "symfony/config": "^7", + "symfony/dependency-injection": "^7", "symfony/http-client-contracts": "^3", "symfony/http-client-implementation": "^3", - "symfony/http-kernel": "^6.4" + "symfony/http-kernel": "^7" }, "provide": { "nbgrp/singlea-payload-fetcher-implementation": "1.0" diff --git a/src/Bundles/Jwt/DependencyInjection/Configuration.php b/src/Bundles/Jwt/DependencyInjection/Configuration.php index 6527d65..7f4595e 100644 --- a/src/Bundles/Jwt/DependencyInjection/Configuration.php +++ b/src/Bundles/Jwt/DependencyInjection/Configuration.php @@ -14,7 +14,7 @@ class Configuration implements ConfigurationInterface { /** - * @suppress PhanPossiblyNonClassMethodCall, PhanPossiblyUndeclaredMethod + * @suppress PhanPossiblyUndeclaredMethod */ public function getConfigTreeBuilder(): TreeBuilder { diff --git a/src/Bundles/Jwt/JwtTokenizer.php b/src/Bundles/Jwt/JwtTokenizer.php index d58a962..a677f9c 100644 --- a/src/Bundles/Jwt/JwtTokenizer.php +++ b/src/Bundles/Jwt/JwtTokenizer.php @@ -12,14 +12,14 @@ use SingleA\Contracts\Tokenization\TokenizerConfigInterface; use SingleA\Contracts\Tokenization\TokenizerInterface; -final class JwtTokenizer implements TokenizerInterface +final readonly class JwtTokenizer implements TokenizerInterface { private Signature\Serializer\CompactSerializer $jwsSerializer; public function __construct( - private readonly string $issuer, - private readonly JWSBuilderFactory $jwsBuilderFactory, - private readonly NestedTokenBuilderFactory $nestedTokenBuilderFactory, + private string $issuer, + private JWSBuilderFactory $jwsBuilderFactory, + private NestedTokenBuilderFactory $nestedTokenBuilderFactory, ) { $this->jwsSerializer = new Signature\Serializer\CompactSerializer(); } diff --git a/src/Bundles/Jwt/SingleaJwtBundle.php b/src/Bundles/Jwt/SingleaJwtBundle.php index 7149a88..3be0359 100644 --- a/src/Bundles/Jwt/SingleaJwtBundle.php +++ b/src/Bundles/Jwt/SingleaJwtBundle.php @@ -9,5 +9,7 @@ /** * @final + * + * @psalm-suppress MissingConstructor */ class SingleaJwtBundle extends Bundle {} diff --git a/src/Bundles/Jwt/composer.json b/src/Bundles/Jwt/composer.json index 86d3871..4a22515 100644 --- a/src/Bundles/Jwt/composer.json +++ b/src/Bundles/Jwt/composer.json @@ -10,16 +10,18 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "ext-json": "*", "nbgrp/singlea-tokenization-contracts": "^1", - "symfony/config": "^6.4", - "symfony/dependency-injection": "^6.4", - "symfony/error-handler": "^6.4", - "symfony/http-kernel": "^6.4", - "web-token/jwt-framework": "^3.0.7" + "symfony/config": "^7", + "symfony/dependency-injection": "^7", + "symfony/error-handler": "^7", + "symfony/http-kernel": "^7", + "web-token/jwt-framework": "^3.2" }, "require-dev": { + "ext-redis": "*", + "predis/predis": "^2", "psr/event-dispatcher": "^1", "psr/event-dispatcher-implementation": "1.0" }, diff --git a/src/Bundles/JwtFetcher/DependencyInjection/Configuration.php b/src/Bundles/JwtFetcher/DependencyInjection/Configuration.php index d0f893b..0c0ac3d 100644 --- a/src/Bundles/JwtFetcher/DependencyInjection/Configuration.php +++ b/src/Bundles/JwtFetcher/DependencyInjection/Configuration.php @@ -14,7 +14,7 @@ class Configuration implements ConfigurationInterface { /** - * @suppress PhanPossiblyNonClassMethodCall, PhanPossiblyUndeclaredMethod + * @suppress PhanPossiblyUndeclaredMethod */ public function getConfigTreeBuilder(): TreeBuilder { diff --git a/src/Bundles/JwtFetcher/JwtFetcher.php b/src/Bundles/JwtFetcher/JwtFetcher.php index e6c20b8..c185c03 100644 --- a/src/Bundles/JwtFetcher/JwtFetcher.php +++ b/src/Bundles/JwtFetcher/JwtFetcher.php @@ -17,16 +17,16 @@ use SingleA\Contracts\PayloadFetcher\FetcherInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; -final class JwtFetcher implements FetcherInterface +final readonly class JwtFetcher implements FetcherInterface { private Signature\Serializer\CompactSerializer $jwsSerializer; public function __construct( - private readonly HttpClientInterface $httpClient, - private readonly JWSBuilderFactory $jwsBuilderFactory, - private readonly NestedTokenBuilderFactory $nestedTokenBuilderFactory, - private readonly JWSLoaderFactory $jwsLoaderFactory, - private readonly NestedTokenLoaderFactory $nestedTokenLoaderFactory, + private HttpClientInterface $httpClient, + private JWSBuilderFactory $jwsBuilderFactory, + private NestedTokenBuilderFactory $nestedTokenBuilderFactory, + private JWSLoaderFactory $jwsLoaderFactory, + private NestedTokenLoaderFactory $nestedTokenLoaderFactory, ) { $this->jwsSerializer = new Signature\Serializer\CompactSerializer(); } diff --git a/src/Bundles/JwtFetcher/SingleaJwtFetcherBundle.php b/src/Bundles/JwtFetcher/SingleaJwtFetcherBundle.php index c1ff290..355c958 100644 --- a/src/Bundles/JwtFetcher/SingleaJwtFetcherBundle.php +++ b/src/Bundles/JwtFetcher/SingleaJwtFetcherBundle.php @@ -9,5 +9,7 @@ /** * @final + * + * @psalm-suppress MissingConstructor */ class SingleaJwtFetcherBundle extends Bundle {} diff --git a/src/Bundles/JwtFetcher/composer.json b/src/Bundles/JwtFetcher/composer.json index ba35af3..aadfdad 100644 --- a/src/Bundles/JwtFetcher/composer.json +++ b/src/Bundles/JwtFetcher/composer.json @@ -10,17 +10,19 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "ext-json": "*", "nbgrp/singlea-payload-fetcher-contracts": "^1", - "symfony/config": "^6.4", - "symfony/dependency-injection": "^6.4", + "symfony/config": "^7", + "symfony/dependency-injection": "^7", "symfony/http-client-contracts": "^3", "symfony/http-client-implementation": "^3", - "symfony/http-kernel": "^6.4", - "web-token/jwt-framework": "^3.0.7" + "symfony/http-kernel": "^7", + "web-token/jwt-framework": "^3.2" }, "require-dev": { + "ext-redis": "*", + "predis/predis": "^2", "psr/event-dispatcher": "^1", "psr/event-dispatcher-implementation": "1.0" }, diff --git a/src/Bundles/Redis/ClientManager.php b/src/Bundles/Redis/ClientManager.php index aa6e6b8..7ff3bc6 100644 --- a/src/Bundles/Redis/ClientManager.php +++ b/src/Bundles/Redis/ClientManager.php @@ -8,12 +8,12 @@ use Psr\Log\LoggerInterface; use SingleA\Contracts\Persistence\ClientManagerInterface; -final class ClientManager implements ClientManagerInterface +final readonly class ClientManager implements ClientManagerInterface { public function __construct( - private readonly string $key, - private readonly \Predis\ClientInterface|\Redis|\RedisCluster|\Relay\Relay $redis, - private readonly ?LoggerInterface $logger = null, + private string $key, + private \Predis\ClientInterface|\Redis|\RedisCluster|\Relay\Relay $redis, + private ?LoggerInterface $logger = null, ) {} public function exists(string $id, bool $touch = true): bool diff --git a/src/Bundles/Redis/DependencyInjection/Configuration.php b/src/Bundles/Redis/DependencyInjection/Configuration.php index e3a1ac5..f5429ba 100644 --- a/src/Bundles/Redis/DependencyInjection/Configuration.php +++ b/src/Bundles/Redis/DependencyInjection/Configuration.php @@ -14,7 +14,7 @@ class Configuration implements ConfigurationInterface { /** - * @suppress PhanPossiblyNonClassMethodCall, PhanPossiblyUndeclaredMethod + * @suppress PhanPossiblyUndeclaredMethod */ public function getConfigTreeBuilder(): TreeBuilder { diff --git a/src/Bundles/Redis/SingleaRedisBundle.php b/src/Bundles/Redis/SingleaRedisBundle.php index 8eeca67..b6b2d1f 100644 --- a/src/Bundles/Redis/SingleaRedisBundle.php +++ b/src/Bundles/Redis/SingleaRedisBundle.php @@ -12,6 +12,8 @@ /** * @final + * + * @psalm-suppress MissingConstructor */ class SingleaRedisBundle extends Bundle { diff --git a/src/Bundles/Redis/composer.json b/src/Bundles/Redis/composer.json index 7f01bef..6670ace 100644 --- a/src/Bundles/Redis/composer.json +++ b/src/Bundles/Redis/composer.json @@ -10,19 +10,20 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "nbgrp/singlea-feature-config-contracts": "^1", "nbgrp/singlea-marshaller-contracts": "^1", "nbgrp/singlea-persistence-contracts": "^1", "psr/log": "^3", - "snc/redis-bundle": "^3.6 || ^4", - "symfony/dependency-injection": "^6.4", - "symfony/http-foundation": "^6.4", - "symfony/http-kernel": "^6.4" + "snc/redis-bundle": "^4", + "symfony/dependency-injection": "^7", + "symfony/http-foundation": "^7", + "symfony/http-kernel": "^7" }, "require-dev": { - "predis/predis": "^1", - "symfony/cache": "^6.4" + "ext-redis": "*", + "predis/predis": "^2", + "symfony/cache": "^7" }, "provide": { "nbgrp/singlea-persistence-implementation": "1.0" diff --git a/src/Bundles/Singlea/ArgumentResolver/FeatureConfigResolver.php b/src/Bundles/Singlea/ArgumentResolver/FeatureConfigResolver.php index 79f98c5..7d75bd4 100644 --- a/src/Bundles/Singlea/ArgumentResolver/FeatureConfigResolver.php +++ b/src/Bundles/Singlea/ArgumentResolver/FeatureConfigResolver.php @@ -18,10 +18,10 @@ * * @see ClientListener */ -final class FeatureConfigResolver implements ValueResolverInterface +final readonly class FeatureConfigResolver implements ValueResolverInterface { public function __construct( - private readonly ConfigRetrieverInterface $configRetriever, + private ConfigRetrieverInterface $configRetriever, ) {} public function resolve(Request $request, ArgumentMetadata $argument): array diff --git a/src/Bundles/Singlea/Controller/Feature/Token.php b/src/Bundles/Singlea/Controller/Feature/Token.php index 449eb37..59bfe98 100644 --- a/src/Bundles/Singlea/Controller/Feature/Token.php +++ b/src/Bundles/Singlea/Controller/Feature/Token.php @@ -20,13 +20,13 @@ use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException; #[AsController] -final class Token +final readonly class Token { /** * @param iterable $tokenizers */ public function __construct( - private readonly iterable $tokenizers, + private iterable $tokenizers, ) {} public function __invoke( diff --git a/src/Bundles/Singlea/DependencyInjection/Configuration.php b/src/Bundles/Singlea/DependencyInjection/Configuration.php index c844336..2641e37 100644 --- a/src/Bundles/Singlea/DependencyInjection/Configuration.php +++ b/src/Bundles/Singlea/DependencyInjection/Configuration.php @@ -15,7 +15,7 @@ class Configuration implements ConfigurationInterface { /** - * @suppress PhanPossiblyNonClassMethodCall, PhanPossiblyUndeclaredMethod + * @suppress PhanPossiblyUndeclaredMethod */ public function getConfigTreeBuilder(): TreeBuilder { diff --git a/src/Bundles/Singlea/EventListener/ClientListener.php b/src/Bundles/Singlea/EventListener/ClientListener.php index c0c1517..50101a9 100644 --- a/src/Bundles/Singlea/EventListener/ClientListener.php +++ b/src/Bundles/Singlea/EventListener/ClientListener.php @@ -14,16 +14,16 @@ use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Uid\UuidV6; -final class ClientListener +final readonly class ClientListener { public const CLIENT_ID_ATTRIBUTE = '__client_id'; public const SECRET_ATTRIBUTE = '__secret'; public function __construct( - private readonly string $clientIdQueryParameterName, - private readonly string $secretQueryParameterName, - private readonly ClientManagerInterface $clientManager, - private readonly ?LoggerInterface $logger = null, + private string $clientIdQueryParameterName, + private string $secretQueryParameterName, + private ClientManagerInterface $clientManager, + private ?LoggerInterface $logger = null, ) {} #[AsEventListener(KernelEvents::REQUEST, priority: 31)] diff --git a/src/Bundles/Singlea/EventListener/ExceptionListener.php b/src/Bundles/Singlea/EventListener/ExceptionListener.php index 8aeeb35..b45c77d 100644 --- a/src/Bundles/Singlea/EventListener/ExceptionListener.php +++ b/src/Bundles/Singlea/EventListener/ExceptionListener.php @@ -16,11 +16,11 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AuthenticationException; -final class ExceptionListener +final readonly class ExceptionListener { public function __construct( - private readonly bool $debug, - private readonly RequestStack $requestStack, + private bool $debug, + private RequestStack $requestStack, ) {} #[AsEventListener(KernelEvents::EXCEPTION, priority: 10)] diff --git a/src/Bundles/Singlea/EventListener/LoginListener.php b/src/Bundles/Singlea/EventListener/LoginListener.php index e88528f..b57d570 100644 --- a/src/Bundles/Singlea/EventListener/LoginListener.php +++ b/src/Bundles/Singlea/EventListener/LoginListener.php @@ -12,17 +12,17 @@ use Symfony\Component\EventDispatcher\Attribute\AsEventListener; use Symfony\Component\HttpFoundation\Cookie; -final class LoginListener +final readonly class LoginListener { public function __construct( - private readonly string $ticketCookieName, - private readonly int $ticketTtl, - private readonly string $ticketDomain, - private readonly string $ticketSameSite, - private readonly bool $stickySession, - private readonly RealmResolverInterface $realmResolver, - private readonly UserAttributesManagerInterface $userAttributesManager, - private readonly ?LoggerInterface $logger = null, + private string $ticketCookieName, + private int $ticketTtl, + private string $ticketDomain, + private string $ticketSameSite, + private bool $stickySession, + private RealmResolverInterface $realmResolver, + private UserAttributesManagerInterface $userAttributesManager, + private ?LoggerInterface $logger = null, ) {} #[AsEventListener(LoginEvent::class)] diff --git a/src/Bundles/Singlea/EventListener/RealmListener.php b/src/Bundles/Singlea/EventListener/RealmListener.php index c723628..d211fb0 100644 --- a/src/Bundles/Singlea/EventListener/RealmListener.php +++ b/src/Bundles/Singlea/EventListener/RealmListener.php @@ -9,13 +9,13 @@ use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; -final class RealmListener +final readonly class RealmListener { public const REALM_ATTRIBUTE = '_singlea_realm'; public function __construct( - private readonly string $realmQueryParameter, - private readonly string $defaultRealm, + private string $realmQueryParameter, + private string $defaultRealm, ) {} #[AsEventListener(KernelEvents::REQUEST, priority: 65)] diff --git a/src/Bundles/Singlea/EventListener/Security/LogoutListener.php b/src/Bundles/Singlea/EventListener/Security/LogoutListener.php index 6c20676..ed6f6c4 100644 --- a/src/Bundles/Singlea/EventListener/Security/LogoutListener.php +++ b/src/Bundles/Singlea/EventListener/Security/LogoutListener.php @@ -13,16 +13,16 @@ use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\Security\Http\Event\LogoutEvent; -final class LogoutListener +final readonly class LogoutListener { public function __construct( - private readonly string $ticketCookieName, - private readonly string $ticketDomain, - private readonly string $ticketSameSite, - private readonly AuthenticationServiceInterface $authenticationService, - private readonly RealmResolverInterface $realmResolver, - private readonly UserAttributesManagerInterface $userAttributesManager, - private readonly ?LoggerInterface $logger = null, + private string $ticketCookieName, + private string $ticketDomain, + private string $ticketSameSite, + private AuthenticationServiceInterface $authenticationService, + private RealmResolverInterface $realmResolver, + private UserAttributesManagerInterface $userAttributesManager, + private ?LoggerInterface $logger = null, ) {} #[AsEventListener(LogoutEvent::class, priority: 65)] diff --git a/src/Bundles/Singlea/EventListener/Security/SuccessfulLoginListener.php b/src/Bundles/Singlea/EventListener/Security/SuccessfulLoginListener.php index b37bb89..c018704 100644 --- a/src/Bundles/Singlea/EventListener/Security/SuccessfulLoginListener.php +++ b/src/Bundles/Singlea/EventListener/Security/SuccessfulLoginListener.php @@ -15,14 +15,14 @@ use Symfony\Component\Security\Http\Event\LoginSuccessEvent; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; -final class SuccessfulLoginListener +final readonly class SuccessfulLoginListener { public function __construct( - private readonly string $ticketCookieName, - private readonly RealmResolverInterface $realmResolver, - private readonly UserAttributesManagerInterface $userAttributesManager, - private readonly EventDispatcherInterface $eventDispatcher, - private readonly ?LoggerInterface $logger = null, + private string $ticketCookieName, + private RealmResolverInterface $realmResolver, + private UserAttributesManagerInterface $userAttributesManager, + private EventDispatcherInterface $eventDispatcher, + private ?LoggerInterface $logger = null, ) {} #[AsEventListener(LoginSuccessEvent::class)] diff --git a/src/Bundles/Singlea/EventListener/TicketListener.php b/src/Bundles/Singlea/EventListener/TicketListener.php index 0ac6ed6..b4cfd1b 100644 --- a/src/Bundles/Singlea/EventListener/TicketListener.php +++ b/src/Bundles/Singlea/EventListener/TicketListener.php @@ -11,13 +11,13 @@ use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; use Symfony\Component\HttpKernel\KernelEvents; -final class TicketListener +final readonly class TicketListener { public const TICKET_ATTRIBUTE = '__ticket'; public function __construct( - private readonly string $ticketHeader, - private readonly ?LoggerInterface $logger = null, + private string $ticketHeader, + private ?LoggerInterface $logger = null, ) {} #[AsEventListener(KernelEvents::REQUEST, priority: 30)] diff --git a/src/Bundles/Singlea/FeatureConfig/ConfigRetriever.php b/src/Bundles/Singlea/FeatureConfig/ConfigRetriever.php index 61dfe2b..3a0c5de 100644 --- a/src/Bundles/Singlea/FeatureConfig/ConfigRetriever.php +++ b/src/Bundles/Singlea/FeatureConfig/ConfigRetriever.php @@ -8,13 +8,13 @@ use SingleA\Contracts\FeatureConfig\FeatureConfigInterface; use SingleA\Contracts\Persistence\FeatureConfigManagerInterface; -final class ConfigRetriever implements ConfigRetrieverInterface +final readonly class ConfigRetriever implements ConfigRetrieverInterface { /** * @param iterable $configManagers */ public function __construct( - private readonly iterable $configManagers, + private iterable $configManagers, ) {} public function exists(string $configInterface, string $clientId): bool diff --git a/src/Bundles/Singlea/Request/RealmRequestMatcher.php b/src/Bundles/Singlea/Request/RealmRequestMatcher.php index 6e03f32..a7f26a5 100644 --- a/src/Bundles/Singlea/Request/RealmRequestMatcher.php +++ b/src/Bundles/Singlea/Request/RealmRequestMatcher.php @@ -9,10 +9,10 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestMatcherInterface; -final class RealmRequestMatcher implements RequestMatcherInterface +final readonly class RealmRequestMatcher implements RequestMatcherInterface { public function __construct( - private readonly string $realm, + private string $realm, ) {} /** diff --git a/src/Bundles/Singlea/Service/Authentication/AuthenticationService.php b/src/Bundles/Singlea/Service/Authentication/AuthenticationService.php index 1f195a3..42d75f3 100644 --- a/src/Bundles/Singlea/Service/Authentication/AuthenticationService.php +++ b/src/Bundles/Singlea/Service/Authentication/AuthenticationService.php @@ -15,13 +15,13 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; -final class AuthenticationService implements AuthenticationServiceInterface +final readonly class AuthenticationService implements AuthenticationServiceInterface { public function __construct( - private readonly string $redirectUriQueryParameter, - private readonly RealmResolverInterface $realmResolver, - private readonly UserAttributesManagerInterface $userAttributesManager, - private readonly EventDispatcherInterface $eventDispatcher, + private string $redirectUriQueryParameter, + private RealmResolverInterface $realmResolver, + private UserAttributesManagerInterface $userAttributesManager, + private EventDispatcherInterface $eventDispatcher, ) {} public function needLogout(TokenInterface $token, Request $request): bool diff --git a/src/Bundles/Singlea/Service/Client/RegistrationResult.php b/src/Bundles/Singlea/Service/Client/RegistrationResult.php index 0f4c183..7841486 100644 --- a/src/Bundles/Singlea/Service/Client/RegistrationResult.php +++ b/src/Bundles/Singlea/Service/Client/RegistrationResult.php @@ -7,12 +7,12 @@ use Symfony\Component\Uid\UuidV6; -final class RegistrationResult +final readonly class RegistrationResult { public function __construct( - private readonly UuidV6 $clientId, - private readonly string $secret, - private readonly array $output, + private UuidV6 $clientId, + private string $secret, + private array $output, ) {} public function getClientId(): UuidV6 diff --git a/src/Bundles/Singlea/Service/Realm/RealmResolver.php b/src/Bundles/Singlea/Service/Realm/RealmResolver.php index cd05d8d..bd03282 100644 --- a/src/Bundles/Singlea/Service/Realm/RealmResolver.php +++ b/src/Bundles/Singlea/Service/Realm/RealmResolver.php @@ -8,10 +8,10 @@ use Symfony\Bundle\SecurityBundle\Security\FirewallMap; use Symfony\Component\HttpFoundation\Request; -final class RealmResolver implements RealmResolverInterface +final readonly class RealmResolver implements RealmResolverInterface { public function __construct( - private readonly FirewallMap $firewallMap, + private FirewallMap $firewallMap, ) {} public function resolve(Request $request): string diff --git a/src/Bundles/Singlea/Service/Signature/SignatureService.php b/src/Bundles/Singlea/Service/Signature/SignatureService.php index 7ef8412..9e5f060 100644 --- a/src/Bundles/Singlea/Service/Signature/SignatureService.php +++ b/src/Bundles/Singlea/Service/Signature/SignatureService.php @@ -10,7 +10,7 @@ use Symfony\Component\ErrorHandler\ErrorHandler; use Symfony\Component\HttpFoundation\Request; -final class SignatureService implements SignatureServiceInterface +final readonly class SignatureService implements SignatureServiceInterface { public const REQUEST_RECEIVED_AT = '_rra'; @@ -22,11 +22,11 @@ final class SignatureService implements SignatureServiceInterface * @param array $extraExcludeParameters */ public function __construct( - private readonly int $requestTtl, - private readonly string $timestampQueryParameter, - private readonly string $signatureQueryParameter, - private readonly array $extraExcludeParameters = [], - private readonly ?LoggerInterface $logger = null, + private int $requestTtl, + private string $timestampQueryParameter, + private string $signatureQueryParameter, + private array $extraExcludeParameters = [], + private ?LoggerInterface $logger = null, ) {} public function check(Request $request, SignatureConfigInterface $config): void diff --git a/src/Bundles/Singlea/Service/Tokenization/PayloadComposer.php b/src/Bundles/Singlea/Service/Tokenization/PayloadComposer.php index 83adab2..faa8f55 100644 --- a/src/Bundles/Singlea/Service/Tokenization/PayloadComposer.php +++ b/src/Bundles/Singlea/Service/Tokenization/PayloadComposer.php @@ -12,15 +12,15 @@ use SingleA\Contracts\Tokenization\TokenizerConfigInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; -final class PayloadComposer implements PayloadComposerInterface +final readonly class PayloadComposer implements PayloadComposerInterface { /** * @param iterable $payloadFetchers */ public function __construct( - private readonly iterable $payloadFetchers, - private readonly EventDispatcherInterface $eventDispatcher, - private readonly ?LoggerInterface $logger = null, + private iterable $payloadFetchers, + private EventDispatcherInterface $eventDispatcher, + private ?LoggerInterface $logger = null, ) {} public function compose( diff --git a/src/Bundles/Singlea/Service/UserAttributes/UserAttributesItem.php b/src/Bundles/Singlea/Service/UserAttributes/UserAttributesItem.php index 4713d97..5c01441 100644 --- a/src/Bundles/Singlea/Service/UserAttributes/UserAttributesItem.php +++ b/src/Bundles/Singlea/Service/UserAttributes/UserAttributesItem.php @@ -5,12 +5,12 @@ namespace SingleA\Bundles\Singlea\Service\UserAttributes; -final class UserAttributesItem implements UserAttributesItemInterface +final readonly class UserAttributesItem implements UserAttributesItemInterface { public function __construct( - private readonly string $identifier, - private readonly array $attributes, - private readonly ?int $ttl, + private string $identifier, + private array $attributes, + private ?int $ttl, ) {} public function getIdentifier(): string diff --git a/src/Bundles/Singlea/Service/UserAttributes/UserAttributesManager.php b/src/Bundles/Singlea/Service/UserAttributes/UserAttributesManager.php index ad9c15d..bf7f138 100644 --- a/src/Bundles/Singlea/Service/UserAttributes/UserAttributesManager.php +++ b/src/Bundles/Singlea/Service/UserAttributes/UserAttributesManager.php @@ -10,15 +10,15 @@ use Symfony\Contracts\Cache\ItemInterface; use Symfony\Contracts\Cache\TagAwareCacheInterface; -final class UserAttributesManager implements UserAttributesManagerInterface +final readonly class UserAttributesManager implements UserAttributesManagerInterface { /** * @param array $pools */ public function __construct( - private readonly array $pools, - private readonly UserAttributesMarshallerInterface $marshaller, - private readonly ?LoggerInterface $logger = null, + private array $pools, + private UserAttributesMarshallerInterface $marshaller, + private ?LoggerInterface $logger = null, ) {} public function exists(string $realm, string $ticket): bool @@ -109,10 +109,7 @@ public function removeByUser(string $userIdentifier): bool return true; } - /** - * @return CacheItemPoolInterface&TagAwareCacheInterface - */ - public function getPool(string $realm) + public function getPool(string $realm): CacheItemPoolInterface&TagAwareCacheInterface { return $this->pools[$realm] ?? throw new \OutOfRangeException('There is no cache pool in realm "'.$realm.'".'); } diff --git a/src/Bundles/Singlea/SingleaBundle.php b/src/Bundles/Singlea/SingleaBundle.php index b9d0b60..a041002 100644 --- a/src/Bundles/Singlea/SingleaBundle.php +++ b/src/Bundles/Singlea/SingleaBundle.php @@ -16,6 +16,8 @@ /** * @final + * + * @psalm-suppress MissingConstructor */ class SingleaBundle extends Bundle { diff --git a/src/Bundles/Singlea/Tests/Command/Client/PurgeTest.php b/src/Bundles/Singlea/Tests/Command/Client/PurgeTest.php index 86efedb..d4e98f2 100644 --- a/src/Bundles/Singlea/Tests/Command/Client/PurgeTest.php +++ b/src/Bundles/Singlea/Tests/Command/Client/PurgeTest.php @@ -42,13 +42,24 @@ public function testSuccessfulPurge(): void ]) ; $clientManager - ->expects(self::exactly(2)) + ->expects($matcher = self::exactly(2)) ->method('getLastAccess') - ->withConsecutive( - ['1ec7d443-a7bf-6112-89fe-3923cde81694'], - ['1ec7e256-14e9-6646-a3fa-37d3996cc17f'], - ) - ->willReturn(new \DateTimeImmutable()) + ->willReturnCallback(static function (string $id) use ($matcher): \DateTimeImmutable { + switch ($matcher->getInvocationCount()) { + case 1: + self::assertSame('1ec7d443-a7bf-6112-89fe-3923cde81694', $id); + break; + + case 2: + self::assertSame('1ec7e256-14e9-6646-a3fa-37d3996cc17f', $id); + break; + + default: + throw new \RuntimeException('Unexpected'); + } + + return new \DateTimeImmutable(); + }) ; $clientManager ->expects(self::once()) diff --git a/src/Bundles/Singlea/composer.json b/src/Bundles/Singlea/composer.json index fb09401..4a9f635 100644 --- a/src/Bundles/Singlea/composer.json +++ b/src/Bundles/Singlea/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "ext-filter": "*", "ext-hash": "*", "ext-json": "*", @@ -32,21 +32,21 @@ "psr/log": "^3", "symfony/cache-contracts": "^3", "symfony/cache-implementation": "^3", - "symfony/config": "^6.4", - "symfony/console": "^6.4", - "symfony/dependency-injection": "^6.4", - "symfony/error-handler": "^6.4", - "symfony/event-dispatcher": "^6.4", + "symfony/config": "^7", + "symfony/console": "^7", + "symfony/dependency-injection": "^7", + "symfony/error-handler": "^7", + "symfony/event-dispatcher": "^7", "symfony/event-dispatcher-contracts": "^3", - "symfony/http-foundation": "^6.4", - "symfony/http-kernel": "^6.4", - "symfony/security-bundle": "^6.4", - "symfony/security-core": "^6.4", - "symfony/security-http": "^6.4", - "symfony/uid": "^6.4" + "symfony/http-foundation": "^7", + "symfony/http-kernel": "^7", + "symfony/security-bundle": "^7", + "symfony/security-core": "^7", + "symfony/security-http": "^7", + "symfony/uid": "^7" }, "require-dev": { - "symfony/expression-language": "^6.4" + "symfony/expression-language": "^7" }, "autoload": { "psr-4": { diff --git a/src/Contracts/FeatureConfig/composer.json b/src/Contracts/FeatureConfig/composer.json index 76f6ca3..e563e3c 100644 --- a/src/Contracts/FeatureConfig/composer.json +++ b/src/Contracts/FeatureConfig/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1" + "php": "^8.2" }, "autoload": { "psr-4": { diff --git a/src/Contracts/Marshaller/composer.json b/src/Contracts/Marshaller/composer.json index 33174d4..ec4a2d6 100644 --- a/src/Contracts/Marshaller/composer.json +++ b/src/Contracts/Marshaller/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "nbgrp/singlea-feature-config-contracts": "^1" }, "autoload": { diff --git a/src/Contracts/PayloadFetcher/composer.json b/src/Contracts/PayloadFetcher/composer.json index ba948ec..f8c19e6 100644 --- a/src/Contracts/PayloadFetcher/composer.json +++ b/src/Contracts/PayloadFetcher/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "nbgrp/singlea-feature-config-contracts": "^1" }, "suggest": { diff --git a/src/Contracts/Persistence/composer.json b/src/Contracts/Persistence/composer.json index af9b69d..d335747 100644 --- a/src/Contracts/Persistence/composer.json +++ b/src/Contracts/Persistence/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "nbgrp/singlea-feature-config-contracts": "^1" }, "autoload": { diff --git a/src/Contracts/Tokenization/composer.json b/src/Contracts/Tokenization/composer.json index f4b90a9..def75b8 100644 --- a/src/Contracts/Tokenization/composer.json +++ b/src/Contracts/Tokenization/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "nbgrp/singlea-feature-config-contracts": "^1" }, "suggest": { diff --git a/src/Contracts/composer.json b/src/Contracts/composer.json index 6b92f2d..d31dfff 100644 --- a/src/Contracts/composer.json +++ b/src/Contracts/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1" + "php": "^8.2" }, "replace": { "nbgrp/singlea-extra-payload-fetcher-contracts": "self.version",