From ccbaba02a6861264cede35a9bd95c90e381f4d51 Mon Sep 17 00:00:00 2001 From: Julian Stier Date: Thu, 25 Jan 2018 23:29:03 +0100 Subject: [PATCH] Upgraded to symfony/console 4.0 --- composer.json | 2 +- src/MageApplication.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 10ae4de..4dd111d 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "require": { "php": ">=5.5.9", "monolog/monolog": "^1.0", - "symfony/console": "^3.0", + "symfony/console": "4.0", "symfony/filesystem": "^3.0", "symfony/event-dispatcher": "^3.0", "symfony/finder": "^3.0", diff --git a/src/MageApplication.php b/src/MageApplication.php index cb20d30..7a98854 100644 --- a/src/MageApplication.php +++ b/src/MageApplication.php @@ -17,7 +17,7 @@ use Symfony\Component\Finder\SplFileInfo; use Monolog\Logger; use Monolog\Handler\StreamHandler; use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\Console\Event\ConsoleExceptionEvent; +use Symfony\Component\Console\Event\ConsoleErrorEvent; use Symfony\Component\Console\ConsoleEvents; use Symfony\Component\Console\Application; use Symfony\Component\Yaml\Parser; @@ -46,12 +46,12 @@ class MageApplication extends Application $dispatcher = new EventDispatcher(); $this->setDispatcher($dispatcher); - $dispatcher->addListener(ConsoleEvents::EXCEPTION, function (ConsoleExceptionEvent $event) { + $dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleErrorEvent $event) { $output = $event->getOutput(); $command = $event->getCommand(); $output->writeln(sprintf('Oops, exception thrown while running command %s', $command->getName())); $exitCode = $event->getExitCode(); - $event->setException(new \LogicException('Caught exception', $exitCode, $event->getException())); + $event->setError(new \LogicException('Caught exception', $exitCode, $event->getError())); }); $this->runtime = $this->instantiateRuntime();