Skip to content

Commit

Permalink
Drop PHP8.1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Nov 29, 2024
1 parent 8cc045c commit 8626ff4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
php: ['8.2', '8.3', '8.4']
stability: [prefer-lowest, prefer-stable]
steps:
- name: Checkout code
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
],
"require": {
"bakame/http-structured-fields": "dev-master",
"php" : "^8.1"
"php" : "^8.2"
},
"autoload": {
"psr-4": {
"Bakame\\Http\\CacheStatus\\": "src/"
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.64.0",
"phpunit/phpunit": "^10.5.15 || ^11.4.1",
"symfony/var-dumper": "^6.4.11",
"friendsofphp/php-cs-fixer": "^3.65.0",
"phpunit/phpunit": "^11.4.4",
"symfony/var-dumper": "^6.4.15",
"guzzlehttp/psr7": "^2.7",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan": "^2.0.3",
"phpstan/phpstan-phpunit": "^2.0.1",
"phpstan/phpstan-deprecation-rules": "^2.0.1",
"phpstan/phpstan-strict-rules": "^2.0"
},
"scripts": {
Expand Down
14 changes: 7 additions & 7 deletions src/Forward.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
/**
* @phpstan-import-type SfType from StructuredFieldProvider
*/
final class Forward implements StructuredFieldProvider
final readonly class Forward implements StructuredFieldProvider
{
public function __construct(
public readonly ForwardedReason $reason,
public readonly ?int $statusCode = null,
public readonly bool $collapsed = false,
public readonly bool $stored = false,
public ForwardedReason $reason,
public ?int $statusCode = null,
public bool $collapsed = false,
public bool $stored = false,
) {
if (null !== $this->statusCode && ($this->statusCode < 100 || $this->statusCode >= 600)) {
throw new Exception('The forward statusCode must be a valid HTTP status code when present.');
Expand Down Expand Up @@ -85,8 +85,8 @@ public function toStructuredField(): Parameters
return Parameters::new()
->append(Properties::Forward->value, $this->reason->toToken())
->when(null !== $this->statusCode, fn (Parameters $parameters) => $parameters->append(Properties::ForwardStatusCode->value, $this->statusCode)) /* @phpstan-ignore-line */
->when(true === $this->stored, fn (Parameters $parameters) => $parameters->append(Properties::Stored->value, $this->stored))
->when(true === $this->collapsed, fn (Parameters $parameters) => $parameters->append(Properties::Collapsed->value, $this->collapsed));
->when($this->stored, fn (Parameters $parameters) => $parameters->append(Properties::Stored->value, $this->stored))
->when($this->collapsed, fn (Parameters $parameters) => $parameters->append(Properties::Collapsed->value, $this->collapsed));
}

public function equals(mixed $other): bool
Expand Down
16 changes: 8 additions & 8 deletions src/HandledRequestCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
*
* @see https://www.rfc-editor.org/rfc/rfc9211.html
*/
final class HandledRequestCache implements StructuredFieldProvider, Stringable
final readonly class HandledRequestCache implements StructuredFieldProvider, Stringable
{
private function __construct(
public readonly Token|string $servedBy,
public readonly bool $hit,
public readonly ?Forward $forward,
public readonly ?int $ttl,
public readonly ?string $key,
public readonly Token|string|null $detail,
public Token|string $servedBy,
public bool $hit,
public ?Forward $forward,
public ?int $ttl,
public ?string $key,
public Token|string|null $detail,
) {
match (true) {
!Type::Token->supports($this->servedBy) && !Type::String->supports($this->servedBy) => throw new Exception('The handled request cache identifier must be a Token or a string.'),
Expand Down Expand Up @@ -135,7 +135,7 @@ private static function validator(): ItemValidator
public function toStructuredField(): Item
{
return Item::new($this->servedBy)
->when(true === $this->hit, fn (Item $item) => $item->appendParameter(Properties::Hit->value, $this->hit))
->when($this->hit, fn (Item $item) => $item->appendParameter(Properties::Hit->value, $this->hit))
->when(null !== $this->forward, fn (Item $item) => $item->mergeParametersByPairs($this->forward)) /* @phpstan-ignore-line */
->when(null !== $this->ttl, fn (Item $item) => $item->appendParameter(Properties::TimeToLive->value, $this->ttl)) /* @phpstan-ignore-line */
->when(null !== $this->key, fn (Item $item) => $item->appendParameter(Properties::Key->value, $this->key)) /* @phpstan-ignore-line */
Expand Down

0 comments on commit 8626ff4

Please sign in to comment.