Skip to content

[Console] remove debug dependency that was dead code #24961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\Console\Exception\CommandNotFoundException;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Debug\Exception\FatalThrowableError;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
Expand Down Expand Up @@ -120,13 +119,8 @@ public function run(InputInterface $input = null, OutputInterface $output = null
$this->configureIO($input, $output);

try {
$e = null;
$exitCode = $this->doRun($input, $output);
} catch (\Exception $e) {
} catch (\Throwable $e) {
}

if (null !== $e) {
if (!$this->catchExceptions || !$e instanceof \Exception) {
throw $e;
}
Expand Down Expand Up @@ -201,11 +195,12 @@ public function doRun(InputInterface $input, OutputInterface $output)
if (null !== $this->dispatcher) {
$event = new ConsoleErrorEvent($input, $output, $e);
$this->dispatcher->dispatch(ConsoleEvents::ERROR, $event);
$e = $event->getError();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some micro optim to not call the method when not needed (same as below)


if (0 === $event->getExitCode()) {
return 0;
}

$e = $event->getError();
}

throw $e;
Expand Down Expand Up @@ -849,7 +844,6 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
}

$event = new ConsoleCommandEvent($command, $input, $output);
$e = null;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused fragment from 3.x


try {
$this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
Expand All @@ -862,10 +856,9 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
} catch (\Throwable $e) {
$event = new ConsoleErrorEvent($input, $output, $e, $command);
$this->dispatcher->dispatch(ConsoleEvents::ERROR, $event);
$e = $event->getError();

if (0 !== $exitCode = $event->getExitCode()) {
throw $e;
throw $event->getError();
}
} finally {
$event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Console/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
],
"require": {
"php": "^7.1.3",
"symfony/polyfill-mbstring": "~1.0",
"symfony/debug": "~3.4|~4.0"
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"symfony/config": "~3.4|~4.0",
Expand Down