File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88use RuntimeException ;
99use Symfony \Component \EventDispatcher \EventDispatcher ;
1010use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
11+ use WonderNetwork \SlimKernel \ServiceFactory ;
12+ use WonderNetwork \SlimKernel \ServicesBuilder ;
1113use function DI \decorate ;
1214
13- final readonly class EventSubscribersCollection {
15+ final readonly class EventSubscribersCollection implements ServiceFactory {
1416 public static function start (): self {
1517 return new self ([]);
1618 }
@@ -69,4 +71,8 @@ public function register(): iterable {
6971 ->addLazyListeners ($ dispatcher , $ container ),
7072 );
7173 }
74+
75+ public function __invoke (ServicesBuilder $ builder ): iterable {
76+ yield from $ this ->register ();
77+ }
7278}
Original file line number Diff line number Diff line change @@ -42,11 +42,12 @@ public function testConsoleLogger(): void {
4242 return $ logger ;
4343 },
4444 ConsoleHandlerEventSubscriber::class => autowire (),
45- ...EventSubscribersCollection::start ()
46- ->add (ConsoleHandlerEventSubscriber::class)
47- ->register (),
4845 ],
4946 )
47+ ->register (
48+ EventSubscribersCollection::start ()
49+ ->add (ConsoleHandlerEventSubscriber::class),
50+ )
5051 ->register (
5152 new SymfonyConsoleServiceFactory (
5253 path: '/src/*Command.php ' ,
You can’t perform that action at this time.
0 commit comments