Skip to content

Commit eb7a918

Browse files
authored
Add Symfony 8 Support (#62)
* Add Symfony 8 Support * add PHP 8.5 workflow
1 parent 59f7d5a commit eb7a918

33 files changed

Lines changed: 200 additions & 187 deletions

.github/workflows/build.yaml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
- "8.2"
5858
- "8.3"
5959
- "8.4"
60+
- "8.5"
6061

6162
dependencies:
6263
- "highest"
@@ -69,6 +70,11 @@ jobs:
6970
exclude:
7071
- php-version: "8.1"
7172
symfony: "^7.0"
73+
include:
74+
- php-version: '8.4'
75+
symfony: '^8.0'
76+
- php-version: '8.5'
77+
symfony: '^8.0'
7278
steps:
7379
- name: "Checkout"
7480
uses: "actions/checkout@v4"
@@ -103,6 +109,7 @@ jobs:
103109
- "8.2"
104110
- "8.3"
105111
- "8.4"
112+
- "8.5"
106113

107114
dependencies:
108115
- "highest"
@@ -115,16 +122,21 @@ jobs:
115122
exclude:
116123
- php-version: "8.1"
117124
symfony: "^7.0"
125+
include:
126+
- php-version: '8.4'
127+
symfony: '^8.0'
128+
- php-version: '8.5'
129+
symfony: '^8.0'
118130
steps:
119131
- name: "Checkout"
120132
uses: "actions/checkout@v4"
121133

122134
- name: "Setup PHP, with composer and extensions"
123135
uses: "shivammathur/setup-php@v2"
124136
with:
125-
php-version: "${{ matrix.php-version }}"
126-
extensions: "${{ env.PHP_EXTENSIONS }}"
127137
coverage: "none"
138+
extensions: "${{ env.PHP_EXTENSIONS }}"
139+
php-version: "${{ matrix.php-version }}"
128140
tools: "flex"
129141

130142
- name: "Install composer dependencies"
@@ -135,7 +147,7 @@ jobs:
135147
dependency-versions: "${{ matrix.dependencies }}"
136148

137149
- name: "Static analysis"
138-
run: "vendor/bin/psalm --php-version=${{ matrix.php-version }}"
150+
run: "vendor/bin/phpstan --no-progress --memory-limit=1G analyse --error-format=github"
139151

140152
unit-tests:
141153
name: "Unit tests"
@@ -149,6 +161,7 @@ jobs:
149161
- "8.2"
150162
- "8.3"
151163
- "8.4"
164+
- "8.5"
152165

153166
dependencies:
154167
- "lowest"
@@ -162,6 +175,11 @@ jobs:
162175
exclude:
163176
- php-version: "8.1"
164177
symfony: "^7.0"
178+
include:
179+
- php-version: '8.4'
180+
symfony: '^8.0'
181+
- php-version: '8.5'
182+
symfony: '^8.0'
165183

166184
steps:
167185
- name: "Checkout"
@@ -171,8 +189,6 @@ jobs:
171189
uses: "shivammathur/setup-php@v2"
172190
with:
173191
php-version: "${{ matrix.php-version }}"
174-
extensions: "${{ env.PHP_EXTENSIONS }}"
175-
coverage: "none"
176192
tools: "flex"
177193

178194
- name: "Install composer dependencies"
@@ -193,7 +209,7 @@ jobs:
193209
strategy:
194210
matrix:
195211
php-version:
196-
- "8.4"
212+
- "8.5"
197213

198214
dependencies:
199215
- "highest"

composer-dependency-analyser.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
55
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;
66
use Symfony\Component\TypeInfo\Type;
7+
use Symfony\Component\PropertyInfo\Type as LegacyType;
78

89
$config = new Configuration();
910

@@ -16,6 +17,9 @@
1617
} else {
1718
$config->ignoreUnknownClasses([Type::class]);
1819
}
20+
if (!class_exists(LegacyType::class)) {
21+
$config->ignoreUnknownClasses([LegacyType::class]);
22+
}
1923

2024
// ignore polyfill
2125
if (version_compare(PHP_VERSION, '8.3.0', '>=')) {

composer.json

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,33 @@
1212
"require": {
1313
"php": ">=8.1",
1414
"doctrine/dbal": "^3.4 || ^4.0",
15-
"doctrine/doctrine-bundle": "^1.9 || ^2.0 || ^3.0",
15+
"doctrine/doctrine-bundle": "^1.9 || ^2.0 || ^3.0 || ^4.0",
1616
"dragonmantank/cron-expression": "^2.2 || ^3.0",
17-
"symfony/config": "^5.4 || ^6.0 || ^7.0",
18-
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
19-
"symfony/form": "^5.4 || ^6.0 || ^7.0",
20-
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0",
21-
"symfony/options-resolver": "^5.4 || ^6.0 || ^7.0",
17+
"symfony/config": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
18+
"symfony/dependency-injection": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
19+
"symfony/form": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
20+
"symfony/http-kernel": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
21+
"symfony/options-resolver": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
2222
"symfony/polyfill-php83": "^1.33",
2323
"symfony/polyfill-php84": "^1.33",
24-
"symfony/property-info": "^5.4 || ^6.0 || ^7.0",
25-
"symfony/validator": "^5.4 || ^6.0 || ^7.0"
24+
"symfony/property-info": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
25+
"symfony/validator": "^5.4.22 || ^6.4 || ^7.0 || ^8.0"
2626
},
2727
"require-dev": {
28-
"ergebnis/composer-normalize": "^2.42",
28+
"ergebnis/composer-normalize": "^2.45",
2929
"matthiasnoback/symfony-dependency-injection-test": "^4.3 || ^5.0 || ^6.0",
3030
"phpdocumentor/reflection-docblock": "^5.3",
31-
"phpunit/phpunit": "^9.5 || ^12.0",
32-
"psalm/plugin-phpunit": "^0.19",
31+
"phpstan/extension-installer": "^1.0",
32+
"phpstan/phpdoc-parser": "^1.0 || ^2.0",
33+
"phpstan/phpstan": "^1.0 || ^2.0",
34+
"phpstan/phpstan-phpunit": "^1.0 || ^2.0",
35+
"phpstan/phpstan-strict-rules": "^1.0 || ^2.0",
36+
"phpstan/phpstan-symfony": "^1.0 || ^2.0",
37+
"phpunit/phpunit": "^10.5 || ^11.0.1 || ^12.0",
3338
"roave/security-advisories": "dev-latest",
3439
"shipmonk/composer-dependency-analyser": "^1.8",
3540
"sylius-labs/coding-standard": "^4.1.1",
36-
"symplify/easy-coding-standard": "^12.3.6",
37-
"vimeo/psalm": "^6.0"
41+
"symplify/easy-coding-standard": "^12.3.6 || ^13.0.0"
3842
},
3943
"prefer-stable": true,
4044
"autoload": {
@@ -50,7 +54,8 @@
5054
"config": {
5155
"allow-plugins": {
5256
"dealerdirect/phpcodesniffer-composer-installer": false,
53-
"ergebnis/composer-normalize": true
57+
"ergebnis/composer-normalize": true,
58+
"phpstan/extension-installer": true
5459
},
5560
"sort-packages": true
5661
},

phpstan-baseline.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
parameters:
2+
reportUnmatchedIgnoredErrors: false

phpstan.neon.dist

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
4+
5+
parameters:
6+
level: 8
7+
paths:
8+
- src
9+
- tests
10+
scanFiles:
11+
- vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php
12+
treatPhpDocTypesAsCertain: false
13+
checkInternalClassCaseSensitivity: true
14+
checkMissingVarTagTypehint: true
15+
checkMissingTypehints: true
16+
checkUninitializedProperties: true
17+
featureToggles:
18+
skipCheckGenericClasses:
19+
- Symfony\Component\Form\AbstractType
20+
- Symfony\Component\Form\FormBuilderInterface
21+
- Symfony\Component\Form\FormInterface
22+
- Symfony\Component\Form\FormTypeExtensionInterface
23+
- Symfony\Component\Form\FormTypeInterface

psalm.xml

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/DependencyInjection/SetonoCronExpressionExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
use Symfony\Component\DependencyInjection\ContainerBuilder;
1111
use Symfony\Component\DependencyInjection\Extension\Extension;
1212
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
13-
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
13+
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
1414

1515
final class SetonoCronExpressionExtension extends Extension implements PrependExtensionInterface
1616
{
1717
#[\Override]
1818
public function load(array $configs, ContainerBuilder $container): void
1919
{
20-
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
21-
$loader->load('services.xml');
20+
$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
21+
$loader->load('services.php');
2222
}
2323

2424
#[\Override]

src/Doctrine/DBAL/Types/CronExpressionType.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?CronExpr
3434
}
3535

3636
if (!is_string($value)) {
37-
/**
38-
* @psalm-suppress UndefinedMethod
39-
*/
37+
/** @phpstan-ignore staticMethod.notFound */
4038
throw class_exists(InvalidType::class) ? InvalidType::new($value, CronExpression::class, ['string']) : ConversionException::conversionFailedInvalidType($value, CronExpression::class, ['string']);
4139
}
4240

@@ -47,9 +45,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?CronExpr
4745
try {
4846
return CronExpression::factory($value);
4947
} catch (\Throwable $e) {
50-
/**
51-
* @psalm-suppress UndefinedMethod
52-
*/
48+
/** @phpstan-ignore staticMethod.notFound */
5349
throw class_exists(ValueNotConvertible::class) ? ValueNotConvertible::new($value, CronExpression::class, null, $e) : ConversionException::conversionFailed($value, CronExpression::class, $e);
5450
}
5551
}
@@ -72,7 +68,11 @@ public function getName(): string
7268
return self::CRON_EXPRESSION_TYPE;
7369
}
7470

75-
/** @noinspection PhpUnusedParameterInspection */
71+
/**
72+
* @noinspection PhpUnusedParameterInspection
73+
*
74+
* @phpstan-ignore return.tooWideBool
75+
*/
7676
public function requiresSQLCommentHint(AbstractPlatform $platform): bool
7777
{
7878
return true;

src/Form/DataTransformer/CronExpressionToPartsTransformer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
/**
1212
* @template-implements DataTransformerInterface<CronExpression, array<string, array<string>>>
13-
*
14-
* @psalm-suppress TooManyTemplateParams
1513
*/
1614
final class CronExpressionToPartsTransformer implements DataTransformerInterface
1715
{
@@ -88,7 +86,9 @@ public function reverseTransform($value): CronExpression
8886
}
8987

9088
/**
91-
* @psalm-assert array<string, array<scalar>> $value
89+
* @phpstan-assert array<string, array<scalar>> $value
90+
*
91+
* @phpstan-ignore missingType.iterableValue
9292
*/
9393
private static function allArrayScalar(array $value): bool
9494
{

src/Form/DataTransformer/CronExpressionToStringPartsTransformer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
/**
1212
* @template-implements DataTransformerInterface<CronExpression, array<string,string>>
13-
*
14-
* @psalm-suppress TooManyTemplateParams
1513
*/
1614
final class CronExpressionToStringPartsTransformer implements DataTransformerInterface
1715
{
@@ -88,7 +86,9 @@ public function reverseTransform($value): CronExpression
8886
}
8987

9088
/**
91-
* @psalm-assert iterable<string> $value
89+
* @phpstan-assert array<string> $value
90+
*
91+
* @phpstan-ignore missingType.iterableValue
9292
*/
9393
private static function allString(array $value): bool
9494
{

0 commit comments

Comments
 (0)