Skip to content

Commit 628425a

Browse files
authored
Drop PHP 8.0 (#339)
* Drop support for PHP 8.0 * Leverage PHP 8.1 features * Fix version check since the expected exception is related to the installed symfony version * Fix set-up of annotation reader * Declare nullable parameter types explicitly Implicit nullable parameter types will become deprecated in PHP 8.4
1 parent 8ed8a99 commit 628425a

30 files changed

+56
-99
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
matrix:
4040
include:
4141
- description: 'Lowest'
42-
php: '8.0'
42+
php: '8.1'
4343
composer_option: '--prefer-lowest'
4444
- description: '8.1'
4545
php: '8.1'

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
'php_unit_mock_short_will_return' => true,
1919
'no_extra_blank_lines' => true,
2020
'no_unused_imports' => true,
21+
'nullable_type_declaration_for_default_null_value' => true,
2122
])
2223
->setFinder($finder)
2324
;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323
],
2424
"require": {
25-
"php": "^8.0",
25+
"php": "^8.1",
2626
"symfony/event-dispatcher-contracts": "^3.0"
2727
},
2828
"require-dev": {

src/Knp/Component/Pager/ArgumentAccess/RequestArgumentAccess.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77

88
final class RequestArgumentAccess implements ArgumentAccessInterface
99
{
10-
private RequestStack $requestStack;
11-
12-
public function __construct(RequestStack $requestStack)
10+
public function __construct(private readonly RequestStack $requestStack)
1311
{
14-
$this->requestStack = $requestStack;
1512
}
1613

1714
public function has(string $name): bool

src/Knp/Component/Pager/Event/AfterEvent.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@
1010
*/
1111
final class AfterEvent extends Event
1212
{
13-
/** @var PaginationInterface<int, mixed> */
14-
private PaginationInterface $pagination;
15-
1613
/**
17-
* @param PaginationInterface<int, mixed> $paginationView
14+
* @param PaginationInterface<int, mixed> $pagination
1815
*/
19-
public function __construct(PaginationInterface $paginationView)
16+
public function __construct(private readonly PaginationInterface $pagination)
2017
{
21-
$this->pagination = $paginationView;
2218
}
2319

2420
/**

src/Knp/Component/Pager/Event/BeforeEvent.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
final class BeforeEvent extends Event
1414
{
1515
public function __construct(
16-
private EventDispatcherInterface $eventDispatcher,
17-
private ArgumentAccessInterface $argumentAccess,
18-
private ?Connection $connection = null
16+
private readonly EventDispatcherInterface $eventDispatcher,
17+
private readonly ArgumentAccessInterface $argumentAccess,
18+
private readonly ?Connection $connection = null
1919
) {
2020
}
2121

src/Knp/Component/Pager/Event/ItemsEvent.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,13 @@ final class ItemsEvent extends Event
2929
*/
3030
public int $count;
3131

32-
private int $offset;
33-
private int $limit;
34-
3532
/**
3633
* @var array<string, mixed>
3734
*/
3835
private array $customPaginationParams = [];
3936

40-
public function __construct(int $offset, int $limit)
37+
public function __construct(private readonly int $offset, private readonly int $limit)
4138
{
42-
$this->offset = $offset;
43-
$this->limit = $limit;
4439
}
4540

4641
public function setCustomPaginationParameter(string $name, mixed $value): void

src/Knp/Component/Pager/Event/Subscriber/Filtration/Doctrine/ORM/QuerySubscriber.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@
1313

1414
class QuerySubscriber implements EventSubscriberInterface
1515
{
16-
private ArgumentAccessInterface $argumentAccess;
17-
18-
public function __construct(ArgumentAccessInterface $argumentAccess)
16+
public function __construct(private readonly ArgumentAccessInterface $argumentAccess)
1917
{
20-
$this->argumentAccess = $argumentAccess;
2118
}
2219

2320
public function items(ItemsEvent $event): void

src/Knp/Component/Pager/Event/Subscriber/Filtration/PropelQuerySubscriber.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010

1111
class PropelQuerySubscriber implements EventSubscriberInterface
1212
{
13-
private ArgumentAccessInterface $argumentAccess;
14-
15-
public function __construct(ArgumentAccessInterface $argumentAccess)
13+
public function __construct(private readonly ArgumentAccessInterface $argumentAccess)
1614
{
17-
$this->argumentAccess = $argumentAccess;
1815
}
1916

2017
public function items(ItemsEvent $event): void

src/Knp/Component/Pager/Event/Subscriber/Paginate/Doctrine/DBALQueryBuilderSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
class DBALQueryBuilderSubscriber implements EventSubscriberInterface
1616
{
17-
public function __construct(private Connection $connection)
17+
public function __construct(private readonly Connection $connection)
1818
{
1919
}
2020

0 commit comments

Comments
 (0)