Skip to content

Commit ffcfdb4

Browse files
fancywebnicolas-grekas
authored andcommitted
Remove \Throwable support deprecation layer
1 parent 8e6cc01 commit ffcfdb4

34 files changed

Lines changed: 67 additions & 113 deletions

UPGRADE-5.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Console
3939
* Removed the `setVerticalBorderChar()` method in favor of the `setVerticalBorderChars()` method in `TableStyle`.
4040
* Removed the `getVerticalBorderChar()` method in favor of the `getBorderChars()` method in `TableStyle`.
4141
* Removed support for returning `null` from `Command::execute()`, return `0` instead
42+
* Renamed `Application::renderException()` and `Application::doRenderException()`
43+
to `renderThrowable()` and `doRenderThrowable()` respectively.
4244
* The `ProcessHelper::run()` method takes the command as an array of arguments.
4345

4446
Before:

src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ public function addLogger(string $name, DebugStack $logger)
5252

5353
/**
5454
* {@inheritdoc}
55-
*
56-
* @param \Throwable|null $exception
5755
*/
58-
public function collect(Request $request, Response $response/*, \Throwable $exception = null*/)
56+
public function collect(Request $request, Response $response, \Throwable $exception = null)
5957
{
6058
$queries = [];
6159
foreach ($this->loggers as $name => $logger) {

src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
* @author Fabien Potencier <fabien@symfony.com>
2828
*
29-
* @final since Symfony 4.4
29+
* @final
3030
*/
3131
class TwigDataCollector extends DataCollector implements LateDataCollectorInterface
3232
{
@@ -43,7 +43,7 @@ public function __construct(Profile $profile, Environment $twig = null)
4343
/**
4444
* {@inheritdoc}
4545
*/
46-
public function collect(Request $request, Response $response, \Exception $exception = null)
46+
public function collect(Request $request, Response $response, \Throwable $exception = null)
4747
{
4848
}
4949

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"symfony/console": "<4.4",
5252
"symfony/form": "<5.0",
5353
"symfony/http-foundation": "<4.4",
54+
"symfony/http-kernel": "<4.4",
5455
"symfony/translation": "<5.0",
5556
"symfony/workflow": "<4.4"
5657
},

src/Symfony/Bundle/FrameworkBundle/DataCollector/RouterDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @author Fabien Potencier <fabien@symfony.com>
2222
*
23-
* @final since Symfony 4.4
23+
* @final
2424
*/
2525
class RouterDataCollector extends BaseRouterDataCollector
2626
{

src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/**
3434
* @author Fabien Potencier <fabien@symfony.com>
3535
*
36-
* @final since Symfony 4.4
36+
* @final
3737
*/
3838
class SecurityDataCollector extends DataCollector implements LateDataCollectorInterface
3939
{
@@ -59,7 +59,7 @@ public function __construct(TokenStorageInterface $tokenStorage = null, RoleHier
5959
/**
6060
* {@inheritdoc}
6161
*/
62-
public function collect(Request $request, Response $response, \Exception $exception = null)
62+
public function collect(Request $request, Response $response, \Throwable $exception = null)
6363
{
6464
if (null === $this->tokenStorage) {
6565
$this->data = [

src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @author Aaron Scherer <aequasi@gmail.com>
2323
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
2424
*
25-
* @final since Symfony 4.4
25+
* @final
2626
*/
2727
class CacheDataCollector extends DataCollector implements LateDataCollectorInterface
2828
{
@@ -39,7 +39,7 @@ public function addInstance(string $name, TraceableAdapter $instance)
3939
/**
4040
* {@inheritdoc}
4141
*/
42-
public function collect(Request $request, Response $response, \Exception $exception = null)
42+
public function collect(Request $request, Response $response, \Throwable $exception = null)
4343
{
4444
$empty = ['calls' => [], 'config' => [], 'options' => [], 'statistics' => []];
4545
$this->data = ['instances' => $empty, 'total' => $empty];

src/Symfony/Component/Cache/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"conflict": {
4242
"doctrine/dbal": "<2.5",
4343
"symfony/dependency-injection": "<4.4",
44+
"symfony/http-kernel": "<4.4",
4445
"symfony/var-dumper": "<4.4"
4546
},
4647
"autoload": {

src/Symfony/Component/Console/Application.php

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
use Symfony\Component\Console\Output\OutputInterface;
4343
use Symfony\Component\Console\Style\SymfonyStyle;
4444
use Symfony\Component\ErrorHandler\ErrorHandler;
45-
use Symfony\Component\ErrorHandler\Exception\ErrorException;
4645
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
4746
use Symfony\Contracts\Service\ResetInterface;
4847

@@ -758,79 +757,19 @@ public static function getAbbreviations(array $names)
758757
return $abbrevs;
759758
}
760759

761-
/**
762-
* Renders a caught exception.
763-
*
764-
* @deprecated since Symfony 4.4, use "renderThrowable()" instead
765-
*/
766-
public function renderException(\Exception $e, OutputInterface $output)
767-
{
768-
@trigger_error(sprintf('The "%s::renderException()" method is deprecated since Symfony 4.4, use "renderThrowable()" instead.', __CLASS__), E_USER_DEPRECATED);
769-
770-
$output->writeln('', OutputInterface::VERBOSITY_QUIET);
771-
772-
$this->doRenderException($e, $output);
773-
774-
$this->finishRenderThrowableOrException($output);
775-
}
776-
777760
public function renderThrowable(\Throwable $e, OutputInterface $output): void
778761
{
779-
if (__CLASS__ !== \get_class($this) && __CLASS__ === (new \ReflectionMethod($this, 'renderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'renderException'))->getDeclaringClass()->getName()) {
780-
@trigger_error(sprintf('The "%s::renderException()" method is deprecated since Symfony 4.4, use "renderThrowable()" instead.', __CLASS__), E_USER_DEPRECATED);
781-
782-
if (!$e instanceof \Exception) {
783-
$e = class_exists(ErrorException::class) ? new ErrorException($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
784-
}
785-
786-
$this->renderException($e, $output);
787-
788-
return;
789-
}
790-
791762
$output->writeln('', OutputInterface::VERBOSITY_QUIET);
792763

793764
$this->doRenderThrowable($e, $output);
794765

795-
$this->finishRenderThrowableOrException($output);
796-
}
797-
798-
private function finishRenderThrowableOrException(OutputInterface $output): void
799-
{
800766
if (null !== $this->runningCommand) {
801767
$output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
802768
$output->writeln('', OutputInterface::VERBOSITY_QUIET);
803769
}
804770
}
805771

806-
/**
807-
* @deprecated since Symfony 4.4, use "doRenderThrowable()" instead
808-
*/
809-
protected function doRenderException(\Exception $e, OutputInterface $output)
810-
{
811-
@trigger_error(sprintf('The "%s::doRenderException()" method is deprecated since Symfony 4.4, use "doRenderThrowable()" instead.', __CLASS__), E_USER_DEPRECATED);
812-
813-
$this->doActuallyRenderThrowable($e, $output);
814-
}
815-
816772
protected function doRenderThrowable(\Throwable $e, OutputInterface $output): void
817-
{
818-
if (__CLASS__ !== \get_class($this) && __CLASS__ === (new \ReflectionMethod($this, 'doRenderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'doRenderException'))->getDeclaringClass()->getName()) {
819-
@trigger_error(sprintf('The "%s::doRenderException()" method is deprecated since Symfony 4.4, use "doRenderThrowable()" instead.', __CLASS__), E_USER_DEPRECATED);
820-
821-
if (!$e instanceof \Exception) {
822-
$e = class_exists(ErrorException::class) ? new ErrorException($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
823-
}
824-
825-
$this->doRenderException($e, $output);
826-
827-
return;
828-
}
829-
830-
$this->doActuallyRenderThrowable($e, $output);
831-
}
832-
833-
private function doActuallyRenderThrowable(\Throwable $e, OutputInterface $output): void
834773
{
835774
do {
836775
$message = trim($e->getMessage());

src/Symfony/Component/Console/CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ CHANGELOG
1212
* removed `TableStyle::getVerticalBorderChar()` method in favor of `TableStyle::getBorderChars()`
1313
* removed support for returning `null` from `Command::execute()`, return `0` instead
1414
* `ProcessHelper::run()` accepts only `array|Symfony\Component\Process\Process` for its `command` argument
15-
* `Application::setDispatcher` accepts only `Symfony\Contracts\EventDispatcher\EventDispatcherInterface`
16-
for its `dispatcher` argument
15+
* `Application::setDispatcher` accepts only `Symfony\Contracts\EventDispatcher\EventDispatcherInterface`
16+
for its `dispatcher` argument
17+
* renamed `Application::renderException()` and `Application::doRenderException()`
18+
to `renderThrowable()` and `doRenderThrowable()` respectively.
1719

1820
4.4.0
1921
-----

0 commit comments

Comments
 (0)