Skip to content

Commit 9494994

Browse files
authored
PHP 8.4 support (#106)
1 parent 91d8895 commit 9494994

12 files changed

+34
-37
lines changed

.github/workflows/bc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ jobs:
3030
os: >-
3131
['ubuntu-latest']
3232
php: >-
33-
['8.1']
33+
['8.4']

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ jobs:
3131
os: >-
3232
['ubuntu-latest', 'windows-latest']
3333
php: >-
34-
['8.1', '8.2', '8.3']
34+
['8.1', '8.2', '8.3', '8.4']

.github/workflows/composer-require-checker.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ jobs:
3131
os: >-
3232
['ubuntu-latest']
3333
php: >-
34-
['8.1', '8.2', '8.3']
34+
['8.1', '8.2', '8.3', '8.4']

.github/workflows/rector.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
on:
2-
pull_request:
2+
pull_request_target:
33
paths-ignore:
44
- 'docs/**'
55
- 'README.md'
@@ -17,7 +17,8 @@ jobs:
1717
secrets:
1818
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
1919
with:
20+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2021
os: >-
2122
['ubuntu-latest']
2223
php: >-
23-
['8.3']
24+
['8.4']

.github/workflows/static.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
os: >-
3030
['ubuntu-latest']
3131
php: >-
32-
['8.1', '8.2', '8.3']
32+
['8.1', '8.2', '8.3', '8.4']

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- New #101: Add `MiddlewareCollector` for Yii Debug package (@xepozz)
66
- Enh #95: Raise minimum PHP version to `^8.1` and make all possible properties readonly (@xepozz)
7+
- Chg #106: Change PHP constraint in `composer.json` to `8.1 - 8.4` (@vjik)
8+
- Enh #106: Mark `MiddlewareStack::$fallbackHandler` readonly (@vjik)
79

810
## 5.2.0 September 25, 2023
911

composer.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@
2727
}
2828
],
2929
"require": {
30-
"php": "^8.1",
31-
"psr/container": "^1.0|^2.0",
30+
"php": "8.1 - 8.4",
31+
"psr/container": "^1.0 || ^2.0",
3232
"psr/event-dispatcher": "^1.0",
33-
"psr/http-message": "^1.0|^2.0",
33+
"psr/http-message": "^1.0 || ^2.0",
3434
"psr/http-server-handler": "^1.0",
3535
"psr/http-server-middleware": "^1.0",
36-
"yiisoft/definitions": "^2.0|^3.0",
36+
"yiisoft/definitions": "^2.0 || ^3.0",
3737
"yiisoft/friendly-exception": "^1.1",
3838
"yiisoft/injector": "^1.0"
3939
},
4040
"require-dev": {
41-
"maglnet/composer-require-checker": "^4.2",
42-
"nyholm/psr7": "^1.4",
43-
"phpunit/phpunit": "^9.5",
44-
"rector/rector": "^1.0.0",
45-
"roave/infection-static-analysis-plugin": "^1.18",
46-
"spatie/phpunit-watcher": "^1.23",
47-
"vimeo/psalm": "^5.3",
48-
"yiisoft/test-support": "^3.0",
41+
"maglnet/composer-require-checker": "^4.7.1",
42+
"nyholm/psr7": "^1.8.2",
43+
"phpunit/phpunit": "^9.6.22",
44+
"rector/rector": "^1.2.10",
45+
"roave/infection-static-analysis-plugin": "^1.35",
46+
"spatie/phpunit-watcher": "^1.24",
47+
"vimeo/psalm": "^5.26.1 || ^6.9.4",
48+
"yiisoft/test-support": "^3.0.2",
4949
"yiisoft/yii-debug": "dev-master"
5050
},
5151
"autoload": {

psalm.xml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
errorLevel="1"
44
findUnusedBaselineEntry="true"
55
findUnusedCode="false"
6+
ensureOverrideAttribute="false"
67
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
78
xmlns="https://getpsalm.org/schema/config"
89
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"

rector.php

+8-15
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,19 @@
66
use Rector\Config\RectorConfig;
77
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
88
use Rector\Php81\Rector\Array_\FirstClassCallableRector;
9-
use Rector\Set\ValueObject\LevelSetList;
109

11-
return static function (RectorConfig $rectorConfig): void {
12-
$rectorConfig->paths([
10+
return RectorConfig::configure()
11+
->withPaths([
1312
__DIR__ . '/src',
1413
__DIR__ . '/tests',
15-
]);
16-
17-
// register a single rule
18-
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
19-
20-
// define sets of rules
21-
$rectorConfig->sets([
22-
LevelSetList::UP_TO_PHP_81,
23-
]);
24-
25-
$rectorConfig->skip([
14+
])
15+
->withPhpSets(php81: true)
16+
->withRules([
17+
InlineConstructorDefaultToPropertyRector::class,
18+
])
19+
->withSkip([
2620
ClassPropertyAssignToConstructorPromotionRector::class,
2721
FirstClassCallableRector::class => [
2822
__DIR__ . '/tests/*',
2923
],
3024
]);
31-
};

src/MiddlewareStack.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ final class MiddlewareStack implements RequestHandlerInterface
3232
*/
3333
public function __construct(
3434
private readonly array $middlewares,
35-
private RequestHandlerInterface $fallbackHandler,
35+
private readonly RequestHandlerInterface $fallbackHandler,
3636
private readonly ?EventDispatcherInterface $eventDispatcher = null
3737
) {
3838
if ($middlewares === []) {

tests/MiddlewareDispatcherTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
236236
}
237237

238238
private function createDispatcher(
239-
ContainerInterface $container = null,
239+
?ContainerInterface $container = null,
240240
?EventDispatcherInterface $eventDispatcher = null
241241
): MiddlewareDispatcher {
242242
if ($container === null) {

tests/MiddlewareFactoryTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ public function testInvalidMiddlewareWithWrongArrayWithIntItems(): void
324324
}
325325

326326
private function getMiddlewareFactory(
327-
ContainerInterface $container = null,
328-
ParametersResolverInterface $parametersResolver = null
327+
?ContainerInterface $container = null,
328+
?ParametersResolverInterface $parametersResolver = null
329329
): MiddlewareFactory {
330330
if ($container !== null) {
331331
return new MiddlewareFactory($container, $parametersResolver);

0 commit comments

Comments
 (0)