remove the deprecated ExceptionController

This commit is contained in:
Christian Flothmann 2019-07-27 12:21:20 +02:00
parent be50e2e177
commit 1266a3963c
3 changed files with 1 additions and 96 deletions

View File

@ -4,7 +4,7 @@ CHANGELOG
5.0.0
-----
* removed the `ExceptionController::templateExists()` method
* removed the `ExceptionController`, use `ExceptionPanelController` instead
* removed the `TemplateManager::templateExists()` method
4.4.0

View File

@ -1,86 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\WebProfilerBundle\Controller;
use Symfony\Component\ErrorRenderer\ErrorRenderer\HtmlErrorRenderer;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Twig\Environment;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ExceptionController::class, ExceptionPanelController::class), E_USER_DEPRECATED);
/**
* ExceptionController.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 4.4, use the ExceptionPanelController instead.
*/
class ExceptionController
{
protected $twig;
protected $debug;
protected $profiler;
private $errorRenderer;
public function __construct(Profiler $profiler = null, Environment $twig, bool $debug, FileLinkFormatter $fileLinkFormat = null, HtmlErrorRenderer $errorRenderer = null)
{
$this->profiler = $profiler;
$this->twig = $twig;
$this->debug = $debug;
$this->errorRenderer = $errorRenderer;
if (null === $errorRenderer) {
$this->errorRenderer = new HtmlErrorRenderer($debug, $this->twig->getCharset(), $fileLinkFormat);
}
}
/**
* Renders the exception panel for the given token.
*
* @return Response A Response instance
*
* @throws NotFoundHttpException
*/
public function showAction(string $token)
{
if (null === $this->profiler) {
throw new NotFoundHttpException('The profiler must be enabled.');
}
$this->profiler->disable();
$exception = $this->profiler->loadProfile($token)->getCollector('exception')->getException();
return new Response($this->errorRenderer->getBody($exception), 200, ['Content-Type' => 'text/html']);
}
/**
* Renders the exception panel stylesheet for the given token.
*
* @return Response A Response instance
*
* @throws NotFoundHttpException
*/
public function cssAction(string $token)
{
if (null === $this->profiler) {
throw new NotFoundHttpException('The profiler must be enabled.');
}
$this->profiler->disable();
return new Response($this->errorRenderer->getStylesheet(), 200, ['Content-Type' => 'text/css']);
}
}

View File

@ -22,15 +22,6 @@
<argument type="service" id="router" on-invalid="null" />
</service>
<service id="web_profiler.controller.exception" class="Symfony\Bundle\WebProfilerBundle\Controller\ExceptionController" public="true">
<argument type="service" id="profiler" on-invalid="null" />
<argument type="service" id="twig" />
<argument>%kernel.debug%</argument>
<argument type="service" id="debug.file_link_formatter" />
<argument type="service" id="error_renderer.renderer.html" />
<deprecated>The "%service_id%" service is deprecated since Symfony 4.4, use the "web_profiler.controller.exception_panel" service instead.</deprecated>
</service>
<service id="web_profiler.controller.exception_panel" class="Symfony\Bundle\WebProfilerBundle\Controller\ExceptionPanelController" public="true">
<argument type="service" id="error_renderer.renderer.html" />
<argument type="service" id="profiler" on-invalid="null" />