Skip to content

Commit e88cb26

Browse files
Remove legacy dispatcher compatibility
1 parent 19675e8 commit e88cb26

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/PHPCR/Shell/Console/Application/ShellApplication.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function init()
100100
$this->registerShellCommands();
101101

102102
$event = new ApplicationInitEvent($this);
103-
$this->dispatch(PhpcrShellEvents::APPLICATION_INIT, $event);
103+
$this->dispatcher->dispatch($event, PhpcrShellEvents::APPLICATION_INIT);
104104
$this->initialized = true;
105105
}
106106

@@ -247,7 +247,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
247247
$name = $this->getCommandName($input);
248248

249249
$event = new Event\CommandPreRunEvent($name, $input);
250-
$this->dispatch(PhpcrShellEvents::COMMAND_PRE_RUN, $event);
250+
$this->dispatcher->dispatch($event, PhpcrShellEvents::COMMAND_PRE_RUN);
251251
$input = $event->getInput();
252252

253253
if (!$name) {
@@ -257,7 +257,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
257257
try {
258258
$exitCode = parent::doRun($input, $output);
259259
} 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);
261261

262262
return 1;
263263
}
@@ -297,7 +297,7 @@ public function add(Command $command)
297297
public function dispatchProfileInitEvent(InputInterface $sessionInput, OutputInterface $output)
298298
{
299299
$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);
301301
}
302302

303303
/**
@@ -334,14 +334,4 @@ public function setDebug($debug)
334334
{
335335
$this->debug = $debug;
336336
}
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-
}
347337
}

0 commit comments

Comments
 (0)