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 21ad7b1 commit 0fcef63
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 40 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $container[1]->parameterByName(key: 'q', default: 1.0); // returns 1.0 if the pa

## System Requirements

**PHP >= 8.1** is required but the latest stable version of PHP is recommended.
**PHP >= 8.2** is required but the latest stable version of PHP is recommended.

## Installation

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
],
"require": {
"php" : "^8.1"
"php" : "^8.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.65.0",
Expand All @@ -48,7 +48,7 @@
"phpstan/phpstan-strict-rules": "^1.6.1",
"phpstan/phpstan-phpunit": "^1.4.1",
"phpstan/phpstan-deprecation-rules": "^1.2.1",
"phpunit/phpunit": "^10.5.15 || ^11.4.4",
"phpunit/phpunit": "^11.4.4",
"phpbench/phpbench": "^1.3.1",
"symfony/var-dumper": "^6.4.15",
"bakame/aide-base32": "dev-main"
Expand Down
2 changes: 1 addition & 1 deletion docs/08-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This will edit (or create) your `composer.json` file.

## PHP version requirement

`bakame/http-structured-fields 2.0` requires a PHP version greater or equal to `8.1` like the previous version.
`bakame/http-structured-fields 2.0` requires a PHP version greater or equal to `8.2` the previous version required `8.1`.

## Interfaces

Expand Down
7 changes: 3 additions & 4 deletions src/Bytes.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
/**
* @see https://www.rfc-editor.org/rfc/rfc9651.html#section-3.3.5
*/
final class Bytes
final readonly class Bytes
{
private function __construct(
private readonly string $value
) {
private function __construct(private string $value)
{
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Dictionary.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
* @implements ArrayAccess<string, InnerList|Item>
* @implements IteratorAggregate<int, array{0:string, 1:InnerList|Item}>
*/
final class Dictionary implements ArrayAccess, Countable, IteratorAggregate
final readonly class Dictionary implements ArrayAccess, Countable, IteratorAggregate
{
/** @var array<string, InnerList|Item> */
private readonly array $members;
private array $members;

/**
* @param iterable<string, SfMemberInput> $members
Expand Down
4 changes: 2 additions & 2 deletions src/DisplayString.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
/**
* @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-sfbis#section-4.2.10
*/
final class DisplayString
final readonly class DisplayString
{
private function __construct(
private readonly string $value
private string $value
) {
}

Expand Down
8 changes: 5 additions & 3 deletions src/InnerList.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,21 @@
* @implements ArrayAccess<int, Item>
* @implements IteratorAggregate<int, Item>
*/
final class InnerList implements ArrayAccess, Countable, IteratorAggregate
final readonly class InnerList implements ArrayAccess, Countable, IteratorAggregate
{
use ParameterAccess;

/** @var list<Item> */
private readonly array $members;
private array $members;
private Parameters $parameters;

/**
* @param iterable<SfItemInput> $members
*/
private function __construct(iterable $members, private readonly Parameters $parameters)
private function __construct(iterable $members, Parameters $parameters)
{
$this->members = array_map($this->filterMember(...), array_values([...$members]));
$this->parameters = $parameters;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
* @phpstan-import-type SfItemPair from StructuredFieldProvider
* @phpstan-import-type SfTypeInput from StructuredFieldProvider
*/
final class Item
final readonly class Item
{
use ParameterAccess;

private function __construct(
private readonly Value $value,
private readonly Parameters $parameters
private Value $value,
private Parameters $parameters
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/MapKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
* @see https://www.rfc-editor.org/rfc/rfc9651.html#section-3.1.2
* @internal normalize HTTP field key
*/
final class MapKey
final readonly class MapKey
{
private function __construct(public readonly string $value)
private function __construct(public string $value)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/OuterList.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
* @implements ArrayAccess<int, InnerList|Item>
* @implements IteratorAggregate<int, InnerList|Item>
*/
final class OuterList implements ArrayAccess, Countable, IteratorAggregate
final readonly class OuterList implements ArrayAccess, Countable, IteratorAggregate
{
/** @var list<InnerList|Item> */
private readonly array $members;
private array $members;

/**
* @param SfMemberInput ...$members
Expand Down
4 changes: 2 additions & 2 deletions src/Parameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
* @implements ArrayAccess<string, InnerList|Item>
* @implements IteratorAggregate<int, array{0:string, 1:Item}>
*/
final class Parameters implements ArrayAccess, Countable, IteratorAggregate
final readonly class Parameters implements ArrayAccess, Countable, IteratorAggregate
{
/** @var array<string, Item> */
private readonly array $members;
private array $members;

/**
* @param iterable<string, SfItemInput> $members
Expand Down
4 changes: 2 additions & 2 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
* @phpstan-import-type SfType from StructuredFieldProvider
*/
final class Parser
final readonly class Parser
{
private const REGEXP_BYTE_SEQUENCE = '/^(?<sequence>:(?<byte>[a-z\d+\/=]*):)/i';
private const REGEXP_BOOLEAN = '/^\?[01]/';
Expand All @@ -54,7 +54,7 @@ public static function new(?Ietf $rfc = null): self
return new self($rfc ?? Ietf::Rfc9651);
}

public function __construct(private readonly Ietf $rfc)
public function __construct(private Ietf $rfc)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
/**
* @see https://www.rfc-editor.org/rfc/rfc9651.html#name-tokens
*/
final class Token
final readonly class Token
{
private function __construct(private readonly string $value)
private function __construct(private string $value)
{
if (1 !== preg_match("/^([a-z*][a-z\d:\/!#\$%&'*+\-.^_`|~]*)$/i", $this->value)) {
throw new SyntaxError('The token '.$this->value.' contains invalid characters.');
Expand Down
6 changes: 3 additions & 3 deletions src/Validation/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace Bakame\Http\StructuredFields\Validation;

final class Result
final readonly class Result
{
private function __construct(
public readonly ValidatedParameters|ValidatedItem|null $data,
public readonly ViolationList $errors,
public ValidatedParameters|ValidatedItem|null $data,
public ViolationList $errors,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Validation/ValidatedItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
use Bakame\Http\StructuredFields\Token;
use DateTimeImmutable;

final class ValidatedItem
final readonly class ValidatedItem
{
public function __construct(
public readonly Bytes|Token|DisplayString|DateTimeImmutable|string|int|float|bool|null $value,
public readonly ValidatedParameters $parameters = new ValidatedParameters(),
public Bytes|Token|DisplayString|DateTimeImmutable|string|int|float|bool|null $value,
public ValidatedParameters $parameters = new ValidatedParameters(),
) {
}
}
4 changes: 2 additions & 2 deletions src/Validation/ValidatedParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
* @implements ArrayAccess<array-key, array{0:string, 1:SfType}|array{}|SfType|null>
* @implements IteratorAggregate<array-key, array{0:string, 1:SfType}|array{}|SfType|null>
*/
final class ValidatedParameters implements ArrayAccess, Countable, IteratorAggregate
final readonly class ValidatedParameters implements ArrayAccess, Countable, IteratorAggregate
{
/**
* @param array<array-key, array{0:string, 1:SfType}|array{}|SfType|null> $values
*/
public function __construct(
private readonly array $values = [],
private array $values = [],
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
* @see https://www.rfc-editor.org/rfc/rfc9651.html#section-3.3
* @internal
*/
final class Value
final readonly class Value
{
public readonly Token|Bytes|DisplayString|DateTimeImmutable|int|float|string|bool $value;
public readonly Type $type;
public Token|Bytes|DisplayString|DateTimeImmutable|int|float|string|bool $value;
public Type $type;

/**
* @throws InvalidArgument
Expand Down

0 comments on commit 0fcef63

Please sign in to comment.