From f81091541b4dd9a7fc2d06f22aff666a9895af75 Mon Sep 17 00:00:00 2001 From: Marcin Czarnecki Date: Thu, 28 May 2026 23:30:10 +0200 Subject: [PATCH 1/2] Remove twig from lower PHP versions --- .github/workflows/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 570ab5703..f2d51a86d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -48,7 +48,9 @@ jobs: - name: Remove symfony/clock for PHP < 8.1 if: ${{ matrix.php-version < '8.1' }} - run: composer remove --dev symfony/clock --no-update + run: | + composer remove --dev symfony/clock --no-update + composer remove --dev twig/twig --no-update - name: Install dependencies with Composer uses: ramsey/composer-install@v4 From 0a34f670b1b75e3c145e4129aca7c443cad54201 Mon Sep 17 00:00:00 2001 From: Marcin Czarnecki Date: Thu, 28 May 2026 23:35:30 +0200 Subject: [PATCH 2/2] Fix tests --- .github/workflows/benchmark.yaml | 4 +++- .github/workflows/static-analysis.yaml | 4 +++- tests/Twig/SerializerExtensionTest.php | 8 ++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 4c8b1bde1..8371e99ef 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -28,7 +28,9 @@ jobs: - name: Remove symfony/clock for PHP < 8.1 if: ${{ matrix.php-version < '8.1' }} - run: composer remove --dev symfony/clock --no-update + run: | + composer remove --dev symfony/clock --no-update + composer remove --dev twig/twig --no-update - name: Install dependencies with Composer uses: ramsey/composer-install@v4 diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml index 7e51144c2..cddb5d811 100644 --- a/.github/workflows/static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -37,7 +37,9 @@ jobs: - name: Remove symfony/clock for PHP < 8.1 if: ${{ matrix.php-version < '8.1' }} - run: composer remove --dev symfony/clock --no-update + run: | + composer remove --dev symfony/clock --no-update + composer remove --dev twig/twig --no-update - name: Install dependencies with Composer uses: ramsey/composer-install@v4 diff --git a/tests/Twig/SerializerExtensionTest.php b/tests/Twig/SerializerExtensionTest.php index 79c729f4a..bf3a60750 100644 --- a/tests/Twig/SerializerExtensionTest.php +++ b/tests/Twig/SerializerExtensionTest.php @@ -8,11 +8,19 @@ use JMS\Serializer\Twig\SerializerRuntimeExtension; use JMS\Serializer\Twig\SerializerRuntimeHelper; use PHPUnit\Framework\TestCase; +use Twig\Extension\AbstractExtension; use Twig\TwigFilter; use Twig\TwigFunction; class SerializerExtensionTest extends TestCase { + protected function setUp(): void + { + if (!class_exists(Twig\Extension\AbstractExtension::class)) { + $this->markTestSkipped('Twig is not available'); + } + } + public function testSerialize() { $mockSerializer = $this->getMockBuilder('JMS\Serializer\SerializerInterface')->getMock();