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

Skip to content

Commit db14f3a

Browse files
committed
Remove \Throwable support deprecation layer
1 parent 9dd6064 commit db14f3a

File tree

26 files changed

+44
-111
lines changed
  • Profiler
  • Tests/Fixtures/DataCollector
  • Mailer/DataCollector
  • Messenger/DataCollector
  • Notifier/DataCollector
  • Translation/DataCollector
  • Validator/DataCollector
  • 26 files changed

    +44
    -111
    lines changed

    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/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/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/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: 4 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -18,8 +18,10 @@
    1818

    1919
    /**
    2020
    * @author Jérémy Romey <jeremy@free-agent.fr>
    21+
    *
    22+
    * @final
    2123
    */
    22-
    final class HttpClientDataCollector extends DataCollector
    24+
    class HttpClientDataCollector extends DataCollector
    2325
    {
    2426
    /**
    2527
    * @var TraceableHttpClient[]
    @@ -34,7 +36,7 @@ public function registerClient(string $name, TraceableHttpClient $client)
    3436
    /**
    3537
    * {@inheritdoc}
    3638
    */
    37-
    public function collect(Request $request, Response $response, \Exception $exception = null)
    39+
    public function collect(Request $request, Response $response, \Throwable $exception = null)
    3840
    {
    3941
    $this->initData();
    4042

    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;

    src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.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 TimeDataCollector extends DataCollector implements LateDataCollectorInterface
    2626
    {
    @@ -36,7 +36,7 @@ public function __construct(KernelInterface $kernel = null, Stopwatch $stopwatch
    3636
    /**
    3737
    * {@inheritdoc}
    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 (null !== $this->kernel) {
    4242
    $startTime = $this->kernel->getStartTime();

    src/Symfony/Component/HttpKernel/Profiler/Profiler.php

    Lines changed: 1 addition & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -132,14 +132,10 @@ public function find(?string $ip, ?string $url, ?string $limit, ?string $method,
    132132
    /**
    133133
    * Collects data for the given Response.
    134134
    *
    135-
    * @param \Throwable|null $exception
    136-
    *
    137135
    * @return Profile|null A Profile instance or null if the profiler is disabled
    138136
    */
    139-
    public function collect(Request $request, Response $response/*, \Throwable $exception = null*/)
    137+
    public function collect(Request $request, Response $response, \Throwable $exception = null)
    140138
    {
    141-
    $exception = 2 < \func_num_args() ? func_get_arg(2) : null;
    142-
    143139
    if (false === $this->enabled) {
    144140
    return null;
    145141
    }

    src/Symfony/Component/HttpKernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -24,7 +24,7 @@ public function __construct($varToClone)
    2424
    $this->varToClone = $varToClone;
    2525
    }
    2626

    27-
    public function collect(Request $request, Response $response, \Exception $exception = null)
    27+
    public function collect(Request $request, Response $response, \Throwable $exception = null)
    2828
    {
    2929
    $this->data = $this->cloneVar($this->varToClone);
    3030
    }

    src/Symfony/Component/Mailer/DataCollector/MessageDataCollector.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -32,7 +32,7 @@ public function __construct(MessageLoggerListener $logger)
    3232
    /**
    3333
    * {@inheritdoc}
    3434
    */
    35-
    public function collect(Request $request, Response $response, \Exception $exception = null)
    35+
    public function collect(Request $request, Response $response, \Throwable $exception = null)
    3636
    {
    3737
    $this->data['events'] = $this->events;
    3838
    }

    0 commit comments

    Comments
     (0)
    0