Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 80f329c

Browse filesBrowse files
committed
Remove deprecated console.exception event
1 parent 1a7dde4 commit 80f329c
Copy full SHA for 80f329c

File tree

5 files changed

+2
-128
lines changed
Filter options

5 files changed

+2
-128
lines changed

‎src/Symfony/Component/Console/Application.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Application.php
-14Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
use Symfony\Component\Console\Helper\FormatterHelper;
3636
use Symfony\Component\Console\Event\ConsoleCommandEvent;
3737
use Symfony\Component\Console\Event\ConsoleErrorEvent;
38-
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
3938
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
4039
use Symfony\Component\Console\Exception\CommandNotFoundException;
4140
use Symfony\Component\Console\Exception\LogicException;
@@ -119,10 +118,6 @@ public function run(InputInterface $input = null, OutputInterface $output = null
119118
$output = new ConsoleOutput();
120119
}
121120

122-
if (null !== $this->dispatcher && $this->dispatcher->hasListeners(ConsoleEvents::EXCEPTION)) {
123-
@trigger_error(sprintf('The "ConsoleEvents::EXCEPTION" event is deprecated since Symfony 3.3 and will be removed in 4.0. Listen to the "ConsoleEvents::ERROR" event instead.'), E_USER_DEPRECATED);
124-
}
125-
126121
$this->configureIO($input, $output);
127122

128123
try {
@@ -822,15 +817,6 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
822817
} catch (\Throwable $e) {
823818
}
824819
if (null !== $e) {
825-
if ($this->dispatcher->hasListeners(ConsoleEvents::EXCEPTION)) {
826-
$x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
827-
$event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
828-
$this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
829-
830-
if ($x !== $event->getException()) {
831-
$e = $event->getException();
832-
}
833-
}
834820
$event = new ConsoleErrorEvent($input, $output, $e, $command);
835821
$this->dispatcher->dispatch(ConsoleEvents::ERROR, $event);
836822
$e = $event->getError();

‎src/Symfony/Component/Console/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ CHANGELOG
77
* removed `QuestionHelper::setInputStream()/getInputStream()`
88
* removed `Application::getTerminalWidth()/getTerminalHeight()` and
99
`Application::setTerminalDimensions()/getTerminalDimensions()`
10+
* removed `ConsoleExceptionEvent`
11+
* removed `ConsoleEvents::EXCEPTION`
1012

1113
3.3.0
1214
-----

‎src/Symfony/Component/Console/ConsoleEvents.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/ConsoleEvents.php
-15Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,6 @@ final class ConsoleEvents
3939
*/
4040
const TERMINATE = 'console.terminate';
4141

42-
/**
43-
* The EXCEPTION event occurs when an uncaught exception appears
44-
* while executing Command#run().
45-
*
46-
* This event allows you to deal with the exception or
47-
* to modify the thrown exception.
48-
*
49-
* @Event("Symfony\Component\Console\Event\ConsoleExceptionEvent")
50-
*
51-
* @var string
52-
*
53-
* @deprecated The console.exception event is deprecated since version 3.3 and will be removed in 4.0. Use the console.error event instead.
54-
*/
55-
const EXCEPTION = 'console.exception';
56-
5742
/**
5843
* The ERROR event occurs when an uncaught exception or error appears.
5944
*

‎src/Symfony/Component/Console/Event/ConsoleExceptionEvent.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Event/ConsoleExceptionEvent.php
-71Lines changed: 0 additions & 71 deletions
This file was deleted.

‎src/Symfony/Component/Console/Tests/ApplicationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/ApplicationTest.php
-28Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use Symfony\Component\Console\Tester\ApplicationTester;
2929
use Symfony\Component\Console\Event\ConsoleCommandEvent;
3030
use Symfony\Component\Console\Event\ConsoleErrorEvent;
31-
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
3231
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
3332
use Symfony\Component\Console\Exception\CommandNotFoundException;
3433
use Symfony\Component\EventDispatcher\EventDispatcher;
@@ -1107,33 +1106,6 @@ public function testConsoleErrorEventIsTriggeredOnCommandNotFound()
11071106
$this->assertEquals(1, $tester->getStatusCode());
11081107
}
11091108

1110-
/**
1111-
* @group legacy
1112-
* @expectedDeprecation The "ConsoleEvents::EXCEPTION" event is deprecated since Symfony 3.3 and will be removed in 4.0. Listen to the "ConsoleEvents::ERROR" event instead.
1113-
*/
1114-
public function testLegacyExceptionListenersAreStillTriggered()
1115-
{
1116-
$dispatcher = $this->getDispatcher();
1117-
$dispatcher->addListener('console.exception', function (ConsoleExceptionEvent $event) {
1118-
$event->getOutput()->write('caught.');
1119-
1120-
$event->setException(new \RuntimeException('replaced in caught.'));
1121-
});
1122-
1123-
$application = new Application();
1124-
$application->setDispatcher($dispatcher);
1125-
$application->setAutoExit(false);
1126-
1127-
$application->register('foo')->setCode(function (InputInterface $input, OutputInterface $output) {
1128-
throw new \RuntimeException('foo');
1129-
});
1130-
1131-
$tester = new ApplicationTester($application);
1132-
$tester->run(array('command' => 'foo'));
1133-
$this->assertContains('before.caught.error.after.', $tester->getDisplay());
1134-
$this->assertContains('replaced in caught.', $tester->getDisplay());
1135-
}
1136-
11371109
/**
11381110
* @requires PHP 7
11391111
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.