Skip to content

Commit 84d73bc

Browse files
committed
Restore PHP8.1 support
1 parent 0fcef63 commit 84d73bc

18 files changed

+39
-42
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-20.04
1111
strategy:
1212
matrix:
13-
php: ['8.2', '8.3', '8.4']
13+
php: ['8.1', '8.2', '8.3', '8.4']
1414
stability: [prefer-lowest, prefer-stable]
1515
steps:
1616
- name: Checkout code

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $container[1]->parameterByName(key: 'q', default: 1.0); // returns 1.0 if the pa
2424

2525
## System Requirements
2626

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

2929
## Installation
3030

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
}
4040
],
4141
"require": {
42-
"php" : "^8.2"
42+
"php" : "^8.1"
4343
},
4444
"require-dev": {
4545
"friendsofphp/php-cs-fixer": "^3.65.0",
@@ -48,7 +48,7 @@
4848
"phpstan/phpstan-strict-rules": "^1.6.1",
4949
"phpstan/phpstan-phpunit": "^1.4.1",
5050
"phpstan/phpstan-deprecation-rules": "^1.2.1",
51-
"phpunit/phpunit": "^11.4.4",
51+
"phpunit/phpunit": "^10.5.38 || ^11.4.4",
5252
"phpbench/phpbench": "^1.3.1",
5353
"symfony/var-dumper": "^6.4.15",
5454
"bakame/aide-base32": "dev-main"

docs/08-migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This will edit (or create) your `composer.json` file.
2121

2222
## PHP version requirement
2323

24-
`bakame/http-structured-fields 2.0` requires a PHP version greater or equal to `8.2` the previous version required `8.1`.
24+
`bakame/http-structured-fields 2.0` requires a PHP version greater or equal to `8.1` as does the previous version.
2525

2626
## Interfaces
2727

src/Bytes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
/**
1515
* @see https://www.rfc-editor.org/rfc/rfc9651.html#section-3.3.5
1616
*/
17-
final readonly class Bytes
17+
final class Bytes
1818
{
19-
private function __construct(private string $value)
19+
private function __construct(private readonly string $value)
2020
{
2121
}
2222

src/Dictionary.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
* @implements ArrayAccess<string, InnerList|Item>
3333
* @implements IteratorAggregate<int, array{0:string, 1:InnerList|Item}>
3434
*/
35-
final readonly class Dictionary implements ArrayAccess, Countable, IteratorAggregate
35+
final class Dictionary implements ArrayAccess, Countable, IteratorAggregate
3636
{
3737
/** @var array<string, InnerList|Item> */
38-
private array $members;
38+
private readonly array $members;
3939

4040
/**
4141
* @param iterable<string, SfMemberInput> $members

src/DisplayString.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
/**
1616
* @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-sfbis#section-4.2.10
1717
*/
18-
final readonly class DisplayString
18+
final class DisplayString
1919
{
20-
private function __construct(
21-
private string $value
22-
) {
20+
private function __construct(private readonly string $value)
21+
{
2322
}
2423

2524
public static function tryFromEncoded(Stringable|string $encoded): ?self

src/InnerList.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
* @implements ArrayAccess<int, Item>
3636
* @implements IteratorAggregate<int, Item>
3737
*/
38-
final readonly class InnerList implements ArrayAccess, Countable, IteratorAggregate
38+
final class InnerList implements ArrayAccess, Countable, IteratorAggregate
3939
{
4040
use ParameterAccess;
4141

4242
/** @var list<Item> */
43-
private array $members;
44-
private Parameters $parameters;
43+
private readonly array $members;
44+
private readonly Parameters $parameters;
4545

4646
/**
4747
* @param iterable<SfItemInput> $members

src/Item.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@
2121
* @phpstan-import-type SfItemPair from StructuredFieldProvider
2222
* @phpstan-import-type SfTypeInput from StructuredFieldProvider
2323
*/
24-
final readonly class Item
24+
final class Item
2525
{
2626
use ParameterAccess;
2727

28-
private function __construct(
29-
private Value $value,
30-
private Parameters $parameters
31-
) {
28+
private function __construct(private readonly Value $value, private readonly Parameters $parameters)
29+
{
3230
}
3331

3432
public static function fromRfc9651(Stringable|string $httpValue): self

src/MapKey.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
* @see https://www.rfc-editor.org/rfc/rfc9651.html#section-3.1.2
1111
* @internal normalize HTTP field key
1212
*/
13-
final readonly class MapKey
13+
final class MapKey
1414
{
15-
private function __construct(public string $value)
15+
private function __construct(public readonly string $value)
1616
{
1717
}
1818

0 commit comments

Comments
 (0)