1515use Symfony \Component \Mercure \Twig \MercureExtension ;
1616use Symfony \UX \StimulusBundle \Helper \StimulusHelper ;
1717use Symfony \UX \Turbo \Broadcaster \IdAccessor ;
18- use Symfony \UX \Turbo \Twig \TurboStreamListenRendererWithOptionsInterface ;
18+ use Symfony \UX \Turbo \Twig \TurboStreamListenRendererInterface ;
1919use Twig \Environment ;
2020use Twig \Error \RuntimeError ;
2121use Twig \Extension \AbstractExtension ;
2525 *
2626 * @author Kévin Dunglas <[email protected] > 2727 */
28- final class TurboStreamListenRenderer implements TurboStreamListenRendererWithOptionsInterface
28+ final class TurboStreamListenRenderer implements TurboStreamListenRendererInterface
2929{
3030 public function __construct (
3131 private HubInterface $ hub ,
@@ -35,12 +35,8 @@ public function __construct(
3535 ) {
3636 }
3737
38- public function renderTurboStreamListen (Environment $ env , $ topic /* array $eventSourceOptions = [] */ ): string
38+ public function renderTurboStreamListen (Environment $ env , $ topic, array $ eventSourceOptions = []): string
3939 {
40- if (\func_num_args () > 2 ) {
41- $ eventSourceOptions = func_get_arg (2 );
42- }
43-
4440 $ topics = $ topic instanceof TopicSet
4541 ? array_map ($ this ->resolveTopic (...), $ topic ->getTopics ())
4642 : [$ this ->resolveTopic ($ topic )];
@@ -52,7 +48,7 @@ public function renderTurboStreamListen(Environment $env, $topic /* array $event
5248 $ controllerAttributes ['topic ' ] = current ($ topics );
5349 }
5450
55- if (isset ( $ eventSourceOptions) ) {
51+ if ([] !== $ eventSourceOptions ) {
5652 try {
5753 // Mercure >= 0.7: https://github.com/symfony/mercure/pull/123
5854 /* @phpstan-ignore-next-line function.alreadyNarrowedType */
0 commit comments