diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d7795a..ae25cba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,9 @@ jobs: with: php-version: '8.4' extensions: mbstring, xml - tools: castor + + - name: Setup Castor + uses: castor-php/setup-castor@v1 - name: Install Composer dependencies run: composer install --prefer-dist --no-interaction @@ -40,7 +42,9 @@ jobs: with: php-version: '8.4' extensions: mbstring, xml - tools: castor + + - name: Setup Castor + uses: castor-php/setup-castor@v1 - name: Install Composer dependencies run: composer install --prefer-dist --no-interaction @@ -61,9 +65,9 @@ jobs: - "8.5" symfony: - '6.4.*' - - '7.3.*' - '7.4.*' - '8.0.*' + - '8.1.*' minimum-stability: [''] composer-flags: [''] name: [''] @@ -71,11 +75,19 @@ jobs: - php-version: 8.2 composer-flags: '--prefer-lowest' name: '(prefer lowest dependencies)' + - php-version: 8.5 + symfony: '8.2.*' + minimum-stability: 'dev' + name: '(dev)' exclude: - php-version: "8.2" symfony: '8.0.*' - php-version: "8.3" symfony: '8.0.*' + - php-version: "8.2" + symfony: '8.1.*' + - php-version: "8.3" + symfony: '8.1.*' steps: - name: Checkout uses: actions/checkout@v6 @@ -89,10 +101,15 @@ jobs: php-version: ${{ matrix.php-version }} extensions: mbstring, xml ini-values: phar.readonly="Off" - tools: castor + + - name: Setup Castor + uses: castor-php/setup-castor@v1 - name: "Configure Symfony" - run: 'composer config extra.symfony.require "${{ matrix.symfony }}"' + run: | + composer global config --no-plugins allow-plugins.symfony/flex true + composer global require --no-progress --no-scripts --no-plugins symfony/flex + composer config extra.symfony.require "${{ matrix.symfony }}" - name: Get composer cache directory id: composer-cache @@ -106,7 +123,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Allow dev dependencies - run: if [ "${{ matrix.minimum-stability }}" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi; + run: if [ "${{ matrix.minimum-stability }}" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev","prefer-stable":true}/' composer.json; fi; - name: Install Composer dependencies run: composer update --prefer-dist --no-interaction ${{ matrix.composer-flags }} diff --git a/.gitignore b/.gitignore index abcbcde..f218929 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ # Temporary /tests/app/var /tests/app/public/bundles +/tests/app/config/reference.php +/tests/app/config/schema.json diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index d5a4a5d..751335c 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -21,6 +21,7 @@ $finder = PhpCsFixer\Finder::create() ->in(__DIR__) ->exclude('app/var') + ->notPath('app/config/reference.php') ->append([ __FILE__, ]) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb59029..37afbb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +* Added support for Symfony 8.2 + ## 1.11.1 (2026-05-26) * Fixed deprecation notice from Symfony 8.1 diff --git a/EventListener/ReplaceImageListener.php b/EventListener/ReplaceImageListener.php index 75bd0c3..8e728f4 100644 --- a/EventListener/ReplaceImageListener.php +++ b/EventListener/ReplaceImageListener.php @@ -57,9 +57,22 @@ public function onKernelResponse(ResponseEvent $event): void $content = (string) $event->getResponse()->getContent(); + $image = \sprintf('Exception detected!', $url); + $content = preg_replace( - '@
(.*?)
@ims', - \sprintf('
Exception detected!
', $url), + [ + // Symfony < 8.2: ghost next to the exception message + '@
(.*?)
@ims', + // Symfony >= 8.2: ghost moved to the bottom of the page, remove it + '@@ims', + // Symfony >= 8.2: put the gif next to the exception message instead + '@
@i', + ], + [ + \sprintf('
%s
', $image), + '', + \sprintf('
%s
', $image), + ], $content ); diff --git a/README.md b/README.md index 7442f2c..1b384ac 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ The GhostBuster of your exception page! -It displays a GIF instead of Symfony's ghost on exception page and it's compatible with Symfony versions from 5.4 to 8.0. +It displays a GIF instead of Symfony's ghost on exception page and it's compatible with Symfony versions from 5.4 to 8.2. Here is what it looks like : ![Demo Symfony 4.4](Resources/doc/images/demo.gif) diff --git a/composer.json b/composer.json index 1653c9e..6e08de9 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "require-dev": { "doctrine/annotations": "^2.0", "friendsofphp/php-cs-fixer": "^3.17", - "phpstan/phpstan": "^1.10", + "phpstan/phpstan": "^2.1", "spatie/image-optimizer": "^1.8", "symfony/asset": "^6.4 || ^7.3 || ^8.0", "symfony/browser-kit": "^6.4 || ^7.3 || ^8.0", @@ -34,7 +34,7 @@ "symfony/dependency-injection": "^6.4 || ^7.3 || ^8.0", "symfony/error-handler": "^6.4 || ^7.3 || ^8.0", "symfony/http-kernel": "^6.4 || ^7.3 || ^8.0", - "symfony/monolog-bundle": "^3.8 || ^7.0", + "symfony/monolog-bundle": "^3.8 || ^4.0", "symfony/phpunit-bridge": "^6.3 || ^7.0", "symfony/stopwatch": "^6.4 || ^7.3 || ^8.0", "symfony/web-profiler-bundle": "^6.4 || ^7.3 || ^8.0", diff --git a/tests/FunctionalTest.php b/tests/FunctionalTest.php index b955f19..5343c51 100644 --- a/tests/FunctionalTest.php +++ b/tests/FunctionalTest.php @@ -83,6 +83,11 @@ private function getImage(string $content): \DOMElement $image = $xpath->query('//div[contains(@class, "exception-illustration")]/svg')->item(0); } + if (!$image) { + // SF >= 8.2 + $image = $xpath->query('//div[contains(@class, "exc-ghost")]/svg')->item(0); + } + $this->assertNotNull($image); return $image;