Skip to content

Commit 877d13c

Browse files
Remove legacy dispatcher compatibility
1 parent 19675e8 commit 877d13c

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

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

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use Symfony\Component\Console\Output\OutputInterface;
2929
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
3030
use Symfony\Component\EventDispatcher\EventDispatcher;
31-
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
3231

3332
/**
3433
* Main application for PHPCRSH.
@@ -100,7 +99,7 @@ public function init()
10099
$this->registerShellCommands();
101100

102101
$event = new ApplicationInitEvent($this);
103-
$this->dispatch(PhpcrShellEvents::APPLICATION_INIT, $event);
102+
$this->dispatcher->dispatch($event, PhpcrShellEvents::APPLICATION_INIT);
104103
$this->initialized = true;
105104
}
106105

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

249248
$event = new Event\CommandPreRunEvent($name, $input);
250-
$this->dispatch(PhpcrShellEvents::COMMAND_PRE_RUN, $event);
249+
$this->dispatcher->dispatch($event, PhpcrShellEvents::COMMAND_PRE_RUN);
251250
$input = $event->getInput();
252251

253252
if (!$name) {
@@ -257,7 +256,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
257256
try {
258257
$exitCode = parent::doRun($input, $output);
259258
} catch (\Exception $e) {
260-
$this->dispatch(PhpcrShellEvents::COMMAND_EXCEPTION, new Event\CommandExceptionEvent($e, $this, $output));
259+
$this->dispatcher->dispatch(new Event\CommandExceptionEvent($e, $this, $output), PhpcrShellEvents::COMMAND_EXCEPTION);
261260

262261
return 1;
263262
}
@@ -297,7 +296,7 @@ public function add(Command $command)
297296
public function dispatchProfileInitEvent(InputInterface $sessionInput, OutputInterface $output)
298297
{
299298
$event = new Event\ProfileInitEvent($this->container->get('config.profile'), $sessionInput, $output);
300-
$this->dispatch(PhpcrShellEvents::PROFILE_INIT, $event);
299+
$this->dispatch($event, PhpcrShellEvents::PROFILE_INIT);
301300
}
302301

303302
/**
@@ -334,14 +333,4 @@ public function setDebug($debug)
334333
{
335334
$this->debug = $debug;
336335
}
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-
}
347336
}

0 commit comments

Comments
 (0)