Skip to content

Commit 2eaa0b7

Browse files
authored
feat: PHP 8.5 and Symfony 8 support (#333)
1 parent 6919e35 commit 2eaa0b7

32 files changed

Lines changed: 155 additions & 134 deletions

.github/workflows/ci.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
php: [ 8.1, 8.2, 8.3 ]
15+
php: [ 8.2, 8.3, 8.4, 8.5 ]
1616
deps: [ highest ]
17-
symfony: [ 6.4.*, 7.0.* ]
17+
symfony: [ 6.4.*, 7.4.*, 8.0.* ]
1818
include:
19-
- php: 8.1
19+
- php: 8.2
2020
deps: lowest
2121
symfony: '*'
2222
exclude:
23-
- php: 8.1
24-
symfony: 7.0.*
23+
- php: 8.2
24+
symfony: 8.0.*
25+
- php: 8.3
26+
symfony: 8.0.*
27+
- php: 8.5
28+
symfony: 6.4.* # laminas-diagnostics doesn't support PHP 8.5 with Symfony 6.4
2529
steps:
26-
- uses: zenstruck/.github@php-test-symfony
30+
- uses: zenstruck/.github/actions/php-test-symfony@main
2731
with:
2832
php: ${{ matrix.php }}
2933
symfony: ${{ matrix.symfony }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/vendor/
44
/build/
55
/var/
6+
/config/reference.php
67
/.php-cs-fixer.cache
78
/.phpunit.result.cache
89
/Tests/app/var/cache/

.php-cs-fixer.dist.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
'@Symfony' => true,
1515
'@Symfony:risky' => true,
1616
'@DoctrineAnnotation' => true,
17-
'@PHP80Migration' => true,
18-
'@PHP80Migration:risky' => true,
19-
'@PHPUnit75Migration:risky' => true,
2017
//'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'],
2118
'multiline_comment_opening_closing' => true,
2219
'array_syntax' => ['syntax' => 'short'],
@@ -42,10 +39,10 @@
4239
'method_private',
4340
],
4441
],
45-
'native_function_invocation' => ['include' => ['@internal']],
42+
'native_function_invocation' => ['include' => ['@internal'], 'exclude' => ['apcu_cache_info', 'apcu_sma_info']],
4643
'explicit_indirect_variable' => true,
4744
'explicit_string_variable' => true,
48-
'escape_implicit_backslashes' => true,
45+
'string_implicit_backslashes' => true,
4946
'mb_str_functions' => true,
5047
'logical_operators' => true,
5148
'php_unit_method_casing' => ['case' => 'snake_case'],

composer.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@
2121
],
2222
"require": {
2323
"php": ">=8.1",
24-
"symfony/framework-bundle": "^6.4|^7.0",
25-
"symfony/string": "^6.4|^7.0",
24+
"symfony/framework-bundle": "^6.4|^7.0|^8.0",
25+
"symfony/string": "^6.4|^7.0|^8.0",
2626
"zenstruck/bytes": "^1.0"
2727
},
2828
"require-dev": {
2929
"colinodell/psr-testlogger": "^1.3",
30-
"doctrine/doctrine-bundle": "^2.11",
30+
"doctrine/doctrine-bundle": "^2.11|^3.0",
3131
"laminas/laminas-diagnostics": "^1.25",
32-
"matthiasnoback/symfony-dependency-injection-test": "^5.1",
32+
"matthiasnoback/symfony-dependency-injection-test": "^6.1",
3333
"phpstan/phpstan": "^1.4",
34-
"phpunit/phpunit": "^9.6.16",
35-
"symfony/http-client": "^6.4|^7.0",
36-
"symfony/mailer": "^6.4|^7.0",
37-
"symfony/messenger": "^6.4|^7.0",
38-
"symfony/phpunit-bridge": "^6.4|^7.0",
39-
"symfony/process": "^6.4|^7.0",
40-
"symfony/routing": "^6.4|^7.0",
41-
"symfony/var-dumper": "^6.4|^7.0",
34+
"phpunit/phpunit": "^9.6.16|^10.0",
35+
"symfony/http-client": "^6.4|^7.0|^8.0",
36+
"symfony/mailer": "^6.4|^7.0|^8.0",
37+
"symfony/messenger": "^6.4|^7.0|^8.0",
38+
"symfony/phpunit-bridge": "^6.4|^7.0|^8.0",
39+
"symfony/process": "^6.4|^7.0|^8.0",
40+
"symfony/routing": "^6.4|^7.0|^8.0",
41+
"symfony/var-dumper": "^6.4|^7.0|^8.0",
4242
"zenstruck/browser": "^1.8",
4343
"zenstruck/console-test": "^1.5",
4444
"zenstruck/mailer-test": "^1.4"

src/Check/Doctrine/DbalConnectionCheck.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,20 @@ public static function configInfo(): ?string
6868

6969
public static function addConfig(ArrayNodeDefinition $node): NodeDefinition
7070
{
71-
return $node // @phpstan-ignore-line
71+
return $node
7272
->beforeNormalization()
73-
->ifTrue(fn($v) => \is_array($v) && \array_is_list($v))
74-
->then(fn($v) => \array_map(fn() => [], \array_combine($v, $v)))
73+
->ifTrue(static fn($v) => \is_array($v) && \array_is_list($v))
74+
->then(static fn($v) => \array_map(static fn() => [], \array_combine($v, $v)))
7575
->end()
7676
->beforeNormalization()
77-
->ifString()->then(fn(string $v) => [['name' => $v]])
77+
->ifString()->then(static fn(string $v) => [['name' => $v]])
7878
->end()
7979
->beforeNormalization()
80-
->ifTrue()->then(fn() => [['name' => self::ALL_CONNECTIONS]])
80+
->ifTrue()->then(static fn() => [['name' => self::ALL_CONNECTIONS]])
8181
->end()
8282
->beforeNormalization()
83-
->ifTrue(fn($v) => \is_array($v) && isset($v['suite']))
84-
->then(fn($v) => [['name' => self::ALL_CONNECTIONS, ...$v]])
83+
->ifTrue(static fn($v) => \is_array($v) && isset($v['suite']))
84+
->then(static fn($v) => [['name' => self::ALL_CONNECTIONS, ...$v]])
8585
->end()
8686
->useAttributeAsKey('name')
8787
->arrayPrototype()
@@ -129,7 +129,7 @@ public static function process(ContainerBuilder $container): void
129129
throw new LogicException('Could not determine Doctrine DBAL connections. Is doctrine/doctrine-bundle installed/enabled?');
130130
}
131131

132-
$config = \array_map(fn() => $config, $container->getParameter('doctrine.connections')); // @phpstan-ignore-line
132+
$config = \array_map(static fn() => $config, $container->getParameter('doctrine.connections')); // @phpstan-ignore-line
133133

134134
self::load($config, $container);
135135
}

src/Check/PercentThresholdCheck.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(int|string $warningThreshold, int|string $criticalTh
4545
*/
4646
public static function addConfig(ArrayNodeDefinition $node): NodeDefinition
4747
{
48-
return $node // @phpstan-ignore-line
48+
return $node
4949
->canBeEnabled()
5050
->children()
5151
->scalarNode('warning')

src/Check/Php/ComposerAuditCheck.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static function configInfo(): ?string
8080

8181
public static function addConfig(ArrayNodeDefinition $node): NodeDefinition
8282
{
83-
return $node // @phpstan-ignore-line
83+
return $node
8484
->canBeEnabled()
8585
->children()
8686
->scalarNode('path')

src/Check/PingUrlCheck.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ public static function configInfo(): ?string
9898

9999
public static function addConfig(ArrayNodeDefinition $node): NodeDefinition
100100
{
101-
return $node // @phpstan-ignore-line
101+
return $node
102102
->arrayPrototype()
103103
->beforeNormalization()
104104
->ifString()
105-
->then(fn(string $url) => ['url' => $url])
105+
->then(static fn(string $url) => ['url' => $url])
106106
->end()
107107
->children()
108108
->scalarNode('url')->isRequired()->cannotBeEmpty()->end()

src/Check/System/DiskUsageCheck.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,24 @@ public static function configInfo(): string
5353

5454
public static function addConfig(ArrayNodeDefinition $node): NodeDefinition
5555
{
56-
return $node // @phpstan-ignore-line
56+
return $node
5757
->beforeNormalization()
58-
->ifTrue()->then(fn() => [['path' => '/']])
58+
->ifTrue()->then(static fn() => [['path' => '/']])
5959
->end()
6060
->beforeNormalization()
61-
->ifString()->then(fn(string $v) => [['path' => $v]])
61+
->ifString()->then(static fn(string $v) => [['path' => $v]])
6262
->end()
6363
->beforeNormalization()
64-
->ifTrue(fn($v) => \is_array($v) && !\array_is_list($v))
65-
->then(function($v) {
64+
->ifTrue(static fn($v) => \is_array($v) && !\array_is_list($v))
65+
->then(static function($v) {
6666
$v['path'] ??= '/';
6767

6868
return [$v];
6969
})
7070
->end()
7171
->arrayPrototype()
7272
->beforeNormalization()
73-
->ifString()->then(fn(string $v) => ['path' => $v])
73+
->ifString()->then(static fn(string $v) => ['path' => $v])
7474
->end()
7575
->children()
7676
->scalarNode('path')->isRequired()->cannotBeEmpty()->end()

src/Check/System/FreeDiskSpaceCheck.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,16 @@ public static function configInfo(): string
8282

8383
public static function addConfig(ArrayNodeDefinition $node): NodeDefinition
8484
{
85-
return $node // @phpstan-ignore-line
85+
return $node
8686
->beforeNormalization()
87-
->ifTrue(fn($v) => \is_array($v) && isset($v['warning']))
88-
->then(function($v) {
89-
return [
90-
[
91-
'path' => $v['path'] ?? '/',
92-
'warning' => $v['warning'],
93-
'critical' => $v['critical'] ?? $v['warning'],
94-
],
95-
];
96-
})
87+
->ifTrue(static fn($v) => \is_array($v) && isset($v['warning']))
88+
->then(static fn($v) => [
89+
[
90+
'path' => $v['path'] ?? '/',
91+
'warning' => $v['warning'],
92+
'critical' => $v['critical'] ?? $v['warning'],
93+
],
94+
])
9795
->end()
9896
->arrayPrototype()
9997
->children()

0 commit comments

Comments
 (0)