@@ -100,7 +100,7 @@ public function init()
100
100
$ this ->registerShellCommands ();
101
101
102
102
$ event = new ApplicationInitEvent ($ this );
103
- $ this ->dispatch (PhpcrShellEvents::APPLICATION_INIT , $ event );
103
+ $ this ->dispatcher -> dispatch ($ event , PhpcrShellEvents::APPLICATION_INIT );
104
104
$ this ->initialized = true ;
105
105
}
106
106
@@ -247,7 +247,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
247
247
$ name = $ this ->getCommandName ($ input );
248
248
249
249
$ event = new Event \CommandPreRunEvent ($ name , $ input );
250
- $ this ->dispatch (PhpcrShellEvents::COMMAND_PRE_RUN , $ event );
250
+ $ this ->dispatcher -> dispatch ($ event , PhpcrShellEvents::COMMAND_PRE_RUN );
251
251
$ input = $ event ->getInput ();
252
252
253
253
if (!$ name ) {
@@ -257,7 +257,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
257
257
try {
258
258
$ exitCode = parent ::doRun ($ input , $ output );
259
259
} catch (\Exception $ e ) {
260
- $ this ->dispatch (PhpcrShellEvents:: COMMAND_EXCEPTION , new Event \CommandExceptionEvent ($ e , $ this , $ output ));
260
+ $ this ->dispatcher -> dispatch (new Event \CommandExceptionEvent ($ e , $ this , $ output ), PhpcrShellEvents:: COMMAND_EXCEPTION );
261
261
262
262
return 1 ;
263
263
}
@@ -297,7 +297,7 @@ public function add(Command $command)
297
297
public function dispatchProfileInitEvent (InputInterface $ sessionInput , OutputInterface $ output )
298
298
{
299
299
$ event = new Event \ProfileInitEvent ($ this ->container ->get ('config.profile ' ), $ sessionInput , $ output );
300
- $ this ->dispatch (PhpcrShellEvents::PROFILE_INIT , $ event );
300
+ $ this ->dispatch ($ event , PhpcrShellEvents::PROFILE_INIT );
301
301
}
302
302
303
303
/**
@@ -334,14 +334,4 @@ public function setDebug($debug)
334
334
{
335
335
$ this ->debug = $ debug ;
336
336
}
337
-
338
- private function dispatch (string $ eventName , $ event )
339
- {
340
- // LegacyEventDispatcherProxy exists in Symfony >= 4.3
341
- if (class_exists (LegacyEventDispatcherProxy::class)) {
342
- return $ this ->dispatcher ->dispatch ($ event , $ eventName );
343
- }
344
-
345
- return $ this ->dispatcher ->dispatch ($ eventName , $ event );
346
- }
347
337
}
0 commit comments