Skip to content

Commit ee9b6a3

Browse files
authored
Add Symfony 8 support (#391)
1 parent c2afa9c commit ee9b6a3

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

.github/workflows/test.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
test:
11-
name: PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }}
11+
name: ${{ matrix.name || format('PHP {0} - {1}', matrix.php-version, matrix.dependencies) }}
1212
runs-on: ubuntu-latest
1313

1414
env:
@@ -28,9 +28,15 @@ jobs:
2828
include:
2929
- php-version: 8.0
3030
dependencies: lowest
31+
name: PHP 8.0 - lowest
3132
- php-version: 8.4
3233
dependencies: highest
33-
symfony-require: 7.2.*
34+
symfony-require: 7.3.*
35+
name: PHP 8.4 - highest - Symfony 7.3
36+
- php-version: 8.4
37+
dependencies: highest
38+
symfony-require: 8.0.*@dev
39+
name: PHP 8.4 - highest - Symfony 8.0@dev
3440

3541
steps:
3642
- name: Checkout
@@ -51,6 +57,14 @@ jobs:
5157
composer global config --no-plugins allow-plugins.symfony/flex true
5258
composer global require --no-progress --no-scripts --no-plugins symfony/flex
5359
60+
- name: Add matrix to composer.json for cache key
61+
if: matrix.symfony-require != ''
62+
run: composer config extra.symfony-require-for-cache "${{ matrix.symfony-require }}"
63+
64+
- name: Remove conflicting dependencies for Symfony 8 dev
65+
if: matrix.symfony-require == '8.0.*@dev'
66+
run: composer remove --dev friendsofphp/php-cs-fixer infection/infection twig/cache-extra --no-update
67+
5468
- name: Install Composer dependencies ${{ matrix.dependencies }}
5569
uses: ramsey/composer-install@v3
5670
with:

bin/twig-cs-fixer

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ use TwigCsFixer\Console\Command\TwigCsFixerCommand;
2020
$command = new TwigCsFixerCommand();
2121

2222
$application = new Application();
23-
$application->add($command);
23+
// Compatibility layer for symfony/console <7.4
24+
if (method_exists($application, 'addCommand')) {
25+
$application->addCommand($command);
26+
} else {
27+
$application->add($command);
28+
}
2429
$application->setDefaultCommand($command->getName());
2530
$application->run();

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"ext-ctype": "*",
1515
"ext-json": "*",
1616
"composer-runtime-api": "^2.0.0",
17-
"symfony/console": "^5.4.9 || ^6.4 || ^7.0",
18-
"symfony/filesystem": "^5.4 || ^6.4 || ^7.0",
19-
"symfony/finder": "^5.4 || ^6.4 || ^7.0",
20-
"symfony/string": "^5.4.42 || ^6.4.10 || ~7.0.10 || ^7.1.3",
17+
"symfony/console": "^5.4.9 || ^6.4 || ^7.0 || ^8.0",
18+
"symfony/filesystem": "^5.4 || ^6.4 || ^7.0 || ^8.0",
19+
"symfony/finder": "^5.4 || ^6.4 || ^7.0 || ^8.0",
20+
"symfony/string": "^5.4.42 || ^6.4.10 || ~7.0.10 || ^7.1.3 || ^8.0",
2121
"twig/twig": "^3.4",
2222
"webmozart/assert": "^1.10"
2323
},
@@ -35,8 +35,8 @@
3535
"phpunit/phpunit": "^9.5.26 || ^11.5.18 || ^12.1.3",
3636
"rector/rector": "^2.0.0",
3737
"shipmonk/composer-dependency-analyser": "^1.6",
38-
"symfony/process": "^5.4 || ^6.4 || ^7.0",
39-
"symfony/twig-bridge": "^5.4 || ^6.4 || ^7.0",
38+
"symfony/process": "^5.4 || ^6.4 || ^7.0 || ^8.0",
39+
"symfony/twig-bridge": "^5.4 || ^6.4 || ^7.0 || ^8.0",
4040
"symfony/ux-twig-component": "^2.2.0",
4141
"twig/cache-extra": "^3.2"
4242
},

tests/Environment/StubbedEnvironmentTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ public function testParse(): void
148148

149149
public function testParseCacheTag(): void
150150
{
151+
if (!InstalledVersions::isInstalled('twig/cache-extra')) {
152+
static::markTestSkipped('twig/cache-extra is required.');
153+
}
154+
151155
$content = file_get_contents(__DIR__.'/Fixtures/cache_tag.html.twig');
152156
static::assertNotFalse($content);
153157

0 commit comments

Comments
 (0)