Skip to content

Commit

Permalink
Merge pull request #593 from Slamdunk/readonly
Browse files Browse the repository at this point in the history
Use `readonly` class annotation where possible
  • Loading branch information
Slamdunk authored Oct 28, 2024
2 parents 12f92de + e4c80ce commit 1fd67b2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/Storageless/Http/ClientFingerprint/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace PSR7Sessions\Storageless\Http\ClientFingerprint;

/** @immutable */
final class Configuration
/** @psalm-immutable */
final readonly class Configuration
{
/** @var list<Source> */
private readonly array $sources;
private array $sources;

/**
* @param list<Source> ...$sources
Expand Down
4 changes: 2 additions & 2 deletions src/Storageless/Http/ClientFingerprint/RemoteAddr.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
10 changes: 5 additions & 5 deletions src/Storageless/Http/ClientFingerprint/SameOriginRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<Source> */
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();
Expand Down
4 changes: 2 additions & 2 deletions src/Storageless/Http/ClientFingerprint/UserAgent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/Storageless/Http/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/Storageless/Http/SessionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
}

Expand Down

0 comments on commit 1fd67b2

Please sign in to comment.