Skip to content

Commit 452f66d

Browse files
committed
[TwigBundle] remove deprecations
1 parent 1f192f1 commit 452f66d

30 files changed

+5
-809
lines changed

src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php

Lines changed: 0 additions & 148 deletions
This file was deleted.

src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ public function getConfigTreeBuilder()
3535
$rootNode
3636
->children()
3737
->scalarNode('exception_controller')
38-
->defaultValue(static function () {
39-
@trigger_error('Relying on the default value ("twig.controller.exception::showAction") of the "twig.exception_controller" configuration option is deprecated since Symfony 4.4, set it to "null" explicitly instead, which will be the new default in 5.0.', E_USER_DEPRECATED);
40-
41-
return 'twig.controller.exception::showAction';
42-
})
38+
->defaultNull()
4339
->end()
4440
->end()
4541
;

src/Symfony/Bundle/TwigBundle/ErrorRenderer/TwigHtmlErrorRenderer.php

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
use Symfony\Component\ErrorRenderer\ErrorRenderer\HtmlErrorRenderer;
1616
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
1717
use Twig\Environment;
18-
use Twig\Error\LoaderError;
19-
use Twig\Loader\ExistsLoaderInterface;
2018

2119
/**
2220
* Provides the ability to render custom Twig-based HTML error pages
@@ -63,7 +61,6 @@ public function render(FlattenException $exception): string
6361
}
6462

6563
return $this->twig->render($template, [
66-
'legacy' => false, // to be removed in 5.0
6764
'exception' => $exception,
6865
'status_code' => $exception->getStatusCode(),
6966
'status_text' => $exception->getTitle(),
@@ -73,39 +70,15 @@ public function render(FlattenException $exception): string
7370
private function findTemplate(int $statusCode): ?string
7471
{
7572
$template = sprintf('@Twig/Exception/error%s.html.twig', $statusCode);
76-
if ($this->templateExists($template)) {
73+
if ($this->twig->getLoader()->exists($template)) {
7774
return $template;
7875
}
7976

8077
$template = '@Twig/Exception/error.html.twig';
81-
if ($this->templateExists($template)) {
78+
if ($this->twig->getLoader()->exists($template)) {
8279
return $template;
8380
}
8481

8582
return null;
8683
}
87-
88-
/**
89-
* To be removed in 5.0.
90-
*
91-
* Use instead:
92-
*
93-
* $this->twig->getLoader()->exists($template)
94-
*/
95-
private function templateExists(string $template): bool
96-
{
97-
$loader = $this->twig->getLoader();
98-
if ($loader instanceof ExistsLoaderInterface || method_exists($loader, 'exists')) {
99-
return $loader->exists($template);
100-
}
101-
102-
try {
103-
$loader->getSourceContext($template);
104-
105-
return true;
106-
} catch (LoaderError $e) {
107-
}
108-
109-
return false;
110-
}
11184
}

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.atom.twig

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.css.twig

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.html.twig

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.js.twig

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.json.twig

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.rdf.twig

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/error.txt.twig

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy