Rename the new exception controller and mark it as internal

This commit is contained in:
Yonel Ceruto 2019-07-25 08:47:54 -04:00
parent f6e93de5cf
commit ba24a51ea4
5 changed files with 14 additions and 20 deletions

View File

@ -7,7 +7,7 @@ CHANGELOG
* Added button to clear the ajax request tab
* Deprecated the `ExceptionController::templateExists()` method
* Deprecated the `TemplateManager::templateExists()` method
* Deprecated the `ExceptionController` in favor of `ExceptionErrorController`
* Deprecated the `ExceptionController` in favor of `ExceptionPanelController`
* Marked all classes of the WebProfilerBundle as internal
4.3.0

View File

@ -20,15 +20,14 @@ use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Loader\ExistsLoaderInterface;
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ExceptionController::class, ExceptionErrorController::class), E_USER_DEPRECATED);
@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 ExceptionErrorController instead.
* @internal since Symfony 4.4
* @deprecated since Symfony 4.4, use the ExceptionPanelController instead.
*/
class ExceptionController
{
@ -106,7 +105,7 @@ class ExceptionController
$template = $this->getTemplate();
if (!$this->templateExists($template, false)) {
if (!$this->templateExists($template)) {
return new Response($this->errorRenderer->getStylesheet(), 200, ['Content-Type' => 'text/css']);
}
@ -118,15 +117,8 @@ class ExceptionController
return '@Twig/Exception/'.($this->debug ? 'exception' : 'error').'.html.twig';
}
/**
* @deprecated since Symfony 4.4
*/
protected function templateExists($template/*, bool $triggerDeprecation = true */)
protected function templateExists($template)
{
if (1 === \func_num_args()) {
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, use the "exists()" method of the Twig loader instead.', __METHOD__), E_USER_DEPRECATED);
}
$loader = $this->twig->getLoader();
if ($loader instanceof ExistsLoaderInterface) {
return $loader->exists($template);

View File

@ -20,8 +20,10 @@ use Symfony\Component\HttpKernel\Profiler\Profiler;
* Renders the exception panel.
*
* @author Yonel Ceruto <yonelceruto@gmail.com>
*
* @internal
*/
class ExceptionErrorController
class ExceptionPanelController
{
private $htmlErrorRenderer;
private $profiler;
@ -46,7 +48,7 @@ class ExceptionErrorController
->getException()
;
return new Response($this->htmlErrorRenderer->getBody($exception));
return new Response($this->htmlErrorRenderer->getBody($exception), 200, ['Content-Type' => 'text/html']);
}
/**
@ -54,6 +56,6 @@ class ExceptionErrorController
*/
public function stylesheet(): Response
{
return new Response($this->htmlErrorRenderer->getStylesheet());
return new Response($this->htmlErrorRenderer->getStylesheet(), 200, ['Content-Type' => 'text/css']);
}
}

View File

@ -28,10 +28,10 @@
<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_error" service instead.</deprecated>
<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_error" class="Symfony\Bundle\WebProfilerBundle\Controller\ExceptionErrorController" public="true">
<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" />
</service>

View File

@ -37,11 +37,11 @@
</route>
<route id="_profiler_exception" path="/{token}/exception">
<default key="_controller">web_profiler.controller.exception_error::body</default>
<default key="_controller">web_profiler.controller.exception_panel::body</default>
</route>
<route id="_profiler_exception_css" path="/{token}/exception.css">
<default key="_controller">web_profiler.controller.exception_error::stylesheet</default>
<default key="_controller">web_profiler.controller.exception_panel::stylesheet</default>
</route>
</routes>