diff --git a/src/Notify/CHANGELOG.md b/src/Notify/CHANGELOG.md index 2a8e3af5ee8..fd7a27c0970 100644 --- a/src/Notify/CHANGELOG.md +++ b/src/Notify/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 2.32 + +- Add support for MercureBundle ^0.4.1 and Mercure ^0.7.0 + ## 2.30 - Ensure compatibility with PHP 8.5 diff --git a/src/Notify/composer.json b/src/Notify/composer.json index 65c5b836be3..8469d8c9f33 100644 --- a/src/Notify/composer.json +++ b/src/Notify/composer.json @@ -32,7 +32,7 @@ "symfony/config": "^5.4|^6.0|^7.0|^8.0", "symfony/dependency-injection": "^5.4|^6.0|^7.0|^8.0", "symfony/http-kernel": "^5.4|^6.0|^7.0|^8.0", - "symfony/mercure-bundle": "^0.3.4", + "symfony/mercure-bundle": "^0.3.4|^0.4.1", "symfony/mercure-notifier": "^5.4|^6.0|^7.0|^8.0", "symfony/stimulus-bundle": "^2.9.1", "symfony/twig-bundle": "^5.4|^6.0|^7.0|^8.0" diff --git a/src/Turbo/CHANGELOG.md b/src/Turbo/CHANGELOG.md index 23ec9a113db..b779a0c16fc 100644 --- a/src/Turbo/CHANGELOG.md +++ b/src/Turbo/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 2.32 + +- Add support for MercureBundle ^0.4.1 and Mercure ^0.7.0 + ## 2.30 - Ensure compatibility with PHP 8.5 diff --git a/src/Turbo/composer.json b/src/Turbo/composer.json index 744de91e48f..6093f2bf3f4 100644 --- a/src/Turbo/composer.json +++ b/src/Turbo/composer.json @@ -45,7 +45,7 @@ "symfony/debug-bundle": "^5.4|^6.0|^7.0|^8.0", "symfony/form": "^5.4|^6.0|^7.0|^8.0", "symfony/framework-bundle": "^6.4|^7.0|^8.0", - "symfony/mercure-bundle": "^0.3.7", + "symfony/mercure-bundle": "^0.3.7|^0.4.1", "symfony/messenger": "^5.4|^6.0|^7.0|^8.0", "symfony/panther": "^2.2", "symfony/phpunit-bridge": "^5.4|^6.0|^7.0|^8.0", diff --git a/src/Turbo/src/Bridge/Mercure/TurboStreamListenRenderer.php b/src/Turbo/src/Bridge/Mercure/TurboStreamListenRenderer.php index 1d4274107c8..c07473d09f9 100644 --- a/src/Turbo/src/Bridge/Mercure/TurboStreamListenRenderer.php +++ b/src/Turbo/src/Bridge/Mercure/TurboStreamListenRenderer.php @@ -19,6 +19,7 @@ use Symfony\WebpackEncoreBundle\Twig\StimulusTwigExtension; use Twig\Environment; use Twig\Error\RuntimeError; +use Twig\Extension\AbstractExtension; /** * Renders the attributes to load the "mercure-turbo-stream" controller. @@ -64,7 +65,11 @@ public function renderTurboStreamListen(Environment $env, $topic /* array $event if (isset($eventSourceOptions)) { try { - $mercure = $this->twig->getExtension(MercureExtension::class); + // Mercure >= 0.7: https://github.com/symfony/mercure/pull/123 + /* @phpstan-ignore-next-line function.alreadyNarrowedType */ + $mercure = is_subclass_of(MercureExtension::class, AbstractExtension::class) + ? $this->twig->getExtension(MercureExtension::class) /* @phpstan-ignore argument.templateType */ + : $this->twig->getRuntime(MercureExtension::class); if ($eventSourceOptions['withCredentials'] ?? false) { $eventSourceOptions['subscribe'] ??= $topics;