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 ;
2121
2424 *
2525 * @author Kévin Dunglas <kevin@dunglas.fr>
2626 */
27- final class TurboStreamListenRenderer implements TurboStreamListenRendererWithOptionsInterface
27+ final class TurboStreamListenRenderer implements TurboStreamListenRendererInterface
2828{
2929 public function __construct (
3030 private HubInterface $ hub ,
@@ -34,12 +34,8 @@ public function __construct(
3434 ) {
3535 }
3636
37- public function renderTurboStreamListen (Environment $ env , $ topic /* array $eventSourceOptions = [] */ ): string
37+ public function renderTurboStreamListen (Environment $ env , $ topic, array $ eventSourceOptions = []): string
3838 {
39- if (\func_num_args () > 2 ) {
40- $ eventSourceOptions = func_get_arg (2 );
41- }
42-
4339 $ topics = $ topic instanceof TopicSet
4440 ? array_map ($ this ->resolveTopic (...), $ topic ->getTopics ())
4541 : [$ this ->resolveTopic ($ topic )];
@@ -51,7 +47,7 @@ public function renderTurboStreamListen(Environment $env, $topic /* array $event
5147 $ controllerAttributes ['topic ' ] = current ($ topics );
5248 }
5349
54- if (isset ( $ eventSourceOptions) ) {
50+ if ([] !== $ eventSourceOptions ) {
5551 try {
5652 $ mercure = $ this ->twig ->getExtension (MercureExtension::class);
5753
0 commit comments