Upgraded to symfony/console 4.0

This commit is contained in:
Julian Stier 2018-01-25 23:29:03 +01:00
parent 1e0223d11b
commit ccbaba02a6
2 changed files with 4 additions and 4 deletions

View file

@ -14,7 +14,7 @@
"require": { "require": {
"php": ">=5.5.9", "php": ">=5.5.9",
"monolog/monolog": "^1.0", "monolog/monolog": "^1.0",
"symfony/console": "^3.0", "symfony/console": "4.0",
"symfony/filesystem": "^3.0", "symfony/filesystem": "^3.0",
"symfony/event-dispatcher": "^3.0", "symfony/event-dispatcher": "^3.0",
"symfony/finder": "^3.0", "symfony/finder": "^3.0",

View file

@ -17,7 +17,7 @@ use Symfony\Component\Finder\SplFileInfo;
use Monolog\Logger; use Monolog\Logger;
use Monolog\Handler\StreamHandler; use Monolog\Handler\StreamHandler;
use Symfony\Component\EventDispatcher\EventDispatcher; 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\ConsoleEvents;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
use Symfony\Component\Yaml\Parser; use Symfony\Component\Yaml\Parser;
@ -46,12 +46,12 @@ class MageApplication extends Application
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$this->setDispatcher($dispatcher); $this->setDispatcher($dispatcher);
$dispatcher->addListener(ConsoleEvents::EXCEPTION, function (ConsoleExceptionEvent $event) { $dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleErrorEvent $event) {
$output = $event->getOutput(); $output = $event->getOutput();
$command = $event->getCommand(); $command = $event->getCommand();
$output->writeln(sprintf('Oops, exception thrown while running command <info>%s</info>', $command->getName())); $output->writeln(sprintf('Oops, exception thrown while running command <info>%s</info>', $command->getName()));
$exitCode = $event->getExitCode(); $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(); $this->runtime = $this->instantiateRuntime();