8000 Remove \Throwable support deprecation layer · symfony/symfony@ffcfdb4 · GitHub
[go: up one dir, main page]

Skip to content

Commit ffcfdb4

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

34 files changed

+67
-113
lines changed

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
-----

src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function __construct(FormDataExtractorInterface $dataExtractor)
8181
/**
8282
* Does nothing. The data is collected during the form event listeners.
8383
*/
84-
public function collect(Request $request, Response $response, \Exception $exception = null)
84+
public function collect(Request $request, Response $response, \Throwable $exception = null)
8585
{
8686
}
8787

src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function registerClient(string $name, TraceableHttpClient $client)
3434
/**
3535
* {@inheritdoc}
3636
*/
37-
public function collect(Request $request, Response $response, \Exception $exception = null)
37+
public function collect(Request $request, Response $response, \Throwable $exception = null)
3838
{
3939
$this->initData();
4040

src/Symfony/Component/HttpClient/composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
"symfony/service-contracts": "^1.0|^2",
3737
"symfony/var-dumper": "^4.4|^5.0"
3838
},
39+
"conflict": {
40+
"symfony/http-kernel": "<4.4"
41+
},
3942
"autoload": {
4043
"psr-4": { "Symfony\\Component\\HttpClient\\": "" },
4144
"exclude-from-classmap": [

src/Symfony/Component/HttpKernel/DataCollector/AjaxDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
*
2020
* @author Bart van den Burg <bart@burgov.nl>
2121
*
22-
* @final since Symfony 4.4
22+
* @final
2323
*/
2424
class AjaxDataCollector extends DataCollector
2525
{
26-
public function collect(Request $request, Response $response, \Exception $exception = null)
26+
public function collect(Request $request, Response $response, \Throwable $exception = null)
2727
{
2828
// all collecting is done client side
2929
}

src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php

Lines changed: 2 additions & 2 deletions
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 ConfigDataCollector extends DataCollector implements LateDataCollectorInterface
2626
{
@@ -46,7 +46,7 @@ public function setKernel(KernelInterface $kernel = null)
4646
/**
4747
* {@inheritdoc}
4848
*/
49-
public function collect(Request $request, Response $response, \Exception $exception = null)
49+
public function collect(Request $request, Response $response, \Throwable $exception = null)
5050
{
5151
$this->data = [
5252
'token' => $response->headers->get('X-Debug-Token'),

src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ interface DataCollectorInterface extends ResetInterface
2424
{
2525
/**
2626
* Collects data for the given Request and Response.
27-
*
28-
* @param \Throwable|null $exception
2927
*/
30-
public function collect(Request $request, Response $response/*, \Throwable $exception = null*/);
28+
public function collect(Request $request, Response $response, \Throwable $exception = null);
3129

3230
/**
3331
* Returns the name of the collector.

src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function dump(Data $data)
9898
}
9999
}
100100

101-
public function collect(Request $request, Response $response, \Exception $exception = null)
101+
public function collect(Request $request, Response $response, \Throwable $exception = null)
102102
{
103103
if (!$this->dataCount) {
104104
$this->data = [];

src/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* @author Fabien Potencier <fabien@symfony.com>
2525
*
26-
* @final since Symfony 4.4
26+
* @final
2727
*/
2828
class EventDataCollector extends DataCollector implements LateDataCollectorInterface
2929
{
@@ -40,7 +40,7 @@ public function __construct(EventDispatcherInterface $dispatcher = null, Request
4040
/**
4141
* {@inheritdoc}
4242
*/
43-
public function collect(Request $request, Response $response, \Exception $exception = null)
43+
public function collect(Request $request, Response $response, \Throwable $exception = null)
4444
{
4545
$this->currentRequest = $this->requestStack && $this->requestStack->getMasterRequest() !== $request ? $request : null;
4646
$this->data = [

src/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
*
2121
* @author Fabien Potencier <fabien@symfony.com>
2222
*
23-
* @final since Symfony 4.4
23+
* @final
2424
*/
2525
class ExceptionDataCollector extends DataCollector
2626
{
2727
/**
2828
* {@inheritdoc}
2929
*/
30-
public function collect(Request $request, Response $response, \Exception $exception = null)
30+
public function collect(Request $request, Response $response, \Throwable $exception = null)
3131
{
3232
if (null !== $exception) {
3333
$this->data = [

src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
* @author Fabien Potencier <fabien@symfony.com>
2424
*
25-
* @final since Symfony 4.4
25+
* @final
2626
*/
2727
class LoggerDataCollector extends DataCollector implements LateDataCollectorInterface
2828
{
@@ -44,7 +44,7 @@ public function __construct($logger = null, string $containerPathPrefix = null,
4444
/**
4545
* {@inheritdoc}
4646
*/
47-
public function collect(Request $request, Response $response, \Exception $exception = null)
47+
public function collect(Request $request, Response $response, \Throwable $exception = null)
4848
{
4949
$this->currentRequest = $this->requestStack && $this->requestStack->getMasterRequest() !== $request ? $request : null;
5050
}

src/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
* @author Fabien Potencier <fabien@symfony.com>
2121
*
22-
* @final since Symfony 4.4
22+
* @final
2323
*/
2424
class MemoryDataCollector extends DataCollector implements LateDataCollectorInterface
2525
{
@@ -31,7 +31,7 @@ public function __construct()
3131
/**
3232
* {@inheritdoc}
3333
*/
34-
public function collect(Request $request, Response $response, \Exception $exception = null)
34+
public function collect(Request $request, Response $response, \Throwable $exception = null)
3535
{
3636
$this->updateMemoryUsage();
3737
}

src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/**
2424
* @author Fabien Potencier <fabien@symfony.com>
2525
*
26-
* @final since Symfony 4.4
26+
* @final
2727
*/
2828
class RequestDataCollector extends DataCollector implements EventSubscriberInterface, LateDataCollectorInterface
2929
{
@@ -37,7 +37,7 @@ public function __construct()
3737
/**
3838
* {@inheritdoc}
3939
*/
40-
public function collect(Request $request, Response $response, \Exception $exception = null)
40+
public function collect(Request $request, Response $response, \Throwable $exception = null)
4141
{
4242
// attributes are serialized and as they can be anything, they need to be converted to strings.
4343
$attributes = [];

src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public function __construct()
3434
/**
3535
* {@inheritdoc}
3636
*
37-
* @final since Symfony 4.4
37+
* @final
3838
*/
39-
public function collect(Request $request, Response $response, \Exception $exception = null)
39+
public function collect(Request $request, Response $response, \Throwable $exception = null)
4040
{
4141
if ($response instanceof RedirectResponse) {
4242
$this->data['redirect'] = true;

0 commit comments

Comments
 (0)
0