diff --git a/src/Storageless/Http/ClientFingerprint/Configuration.php b/src/Storageless/Http/ClientFingerprint/Configuration.php index c243dabe..616af9fd 100644 --- a/src/Storageless/Http/ClientFingerprint/Configuration.php +++ b/src/Storageless/Http/ClientFingerprint/Configuration.php @@ -4,11 +4,11 @@ namespace PSR7Sessions\Storageless\Http\ClientFingerprint; -/** @immutable */ -final class Configuration +/** @psalm-immutable */ +final readonly class Configuration { /** @var list */ - private readonly array $sources; + private array $sources; /** * @param list ...$sources diff --git a/src/Storageless/Http/ClientFingerprint/RemoteAddr.php b/src/Storageless/Http/ClientFingerprint/RemoteAddr.php index fec669dd..252e4052 100644 --- a/src/Storageless/Http/ClientFingerprint/RemoteAddr.php +++ b/src/Storageless/Http/ClientFingerprint/RemoteAddr.php @@ -9,8 +9,8 @@ use function array_key_exists; use function is_string; -/** @immutable */ -final class RemoteAddr implements Source +/** @psalm-immutable */ +final readonly class RemoteAddr implements Source { private const SERVER_PARAM_NAME = 'REMOTE_ADDR'; diff --git a/src/Storageless/Http/ClientFingerprint/SameOriginRequest.php b/src/Storageless/Http/ClientFingerprint/SameOriginRequest.php index b371d6ba..bf5cb6b6 100644 --- a/src/Storageless/Http/ClientFingerprint/SameOriginRequest.php +++ b/src/Storageless/Http/ClientFingerprint/SameOriginRequest.php @@ -22,19 +22,19 @@ /** * @internal * - * @immutable + * @psalm-immutable */ -final class SameOriginRequest implements Constraint +final readonly class SameOriginRequest implements Constraint { public const CLAIM = 'fp'; /** @var list */ - private readonly array $sources; + private array $sources; /** @var non-empty-string */ - private readonly string $currentRequestFingerprint; + private string $currentRequestFingerprint; public function __construct( - private readonly Configuration $configuration, + private Configuration $configuration, ServerRequestInterface $serverRequest, ) { $this->sources = $this->configuration->sources(); diff --git a/src/Storageless/Http/ClientFingerprint/UserAgent.php b/src/Storageless/Http/ClientFingerprint/UserAgent.php index 5463b62e..2009a97c 100644 --- a/src/Storageless/Http/ClientFingerprint/UserAgent.php +++ b/src/Storageless/Http/ClientFingerprint/UserAgent.php @@ -6,8 +6,8 @@ use Psr\Http\Message\ServerRequestInterface; -/** @immutable */ -final class UserAgent implements Source +/** @psalm-immutable */ +final readonly class UserAgent implements Source { public function extractFrom(ServerRequestInterface $request): string { diff --git a/src/Storageless/Http/Configuration.php b/src/Storageless/Http/Configuration.php index e88468b3..abd64ff3 100644 --- a/src/Storageless/Http/Configuration.php +++ b/src/Storageless/Http/Configuration.php @@ -27,7 +27,7 @@ use Lcobucci\JWT\Configuration as JwtConfig; use PSR7Sessions\Storageless\Http\ClientFingerprint\Configuration as FingerprintConfig; -/** @immutable */ +/** @psalm-immutable */ final class Configuration { private JwtConfig $jwtConfiguration; diff --git a/src/Storageless/Http/SessionMiddleware.php b/src/Storageless/Http/SessionMiddleware.php index e7240984..a01d0afd 100644 --- a/src/Storageless/Http/SessionMiddleware.php +++ b/src/Storageless/Http/SessionMiddleware.php @@ -43,14 +43,14 @@ use function sprintf; -/** @immutable */ -final class SessionMiddleware implements MiddlewareInterface +/** @psalm-immutable */ +final readonly class SessionMiddleware implements MiddlewareInterface { public const SESSION_CLAIM = 'session-data'; public const SESSION_ATTRIBUTE = 'session'; public function __construct( - private readonly Configuration $config, + private Configuration $config, ) { }