Skip to content

Commit

Permalink
minor #33476 [TwigBundle] Remove legacy code (yceruto)
Browse files Browse the repository at this point in the history
This PR was merged into the 5.0-dev branch.

Discussion
----------

[TwigBundle] Remove legacy code

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | TODO

See #33271

Commits
-------

abb3258 Remove legacy code
  • Loading branch information
nicolas-grekas committed Sep 5, 2019
2 parents 3bcfe2f + abb3258 commit 6651ee9
Show file tree
Hide file tree
Showing 17 changed files with 4 additions and 224 deletions.
Expand Up @@ -36,13 +36,6 @@ public function registerContainerConfiguration(LoaderInterface $loader)
$loader->load(__DIR__.\DIRECTORY_SEPARATOR.'config.yml');
}

public function setAnnotatedClassCache(array $annotatedClasses)
{
$annotatedClasses = array_diff($annotatedClasses, ['Symfony\Bundle\WebProfilerBundle\Controller\ExceptionController', 'Symfony\Bundle\TwigBundle\Controller\ExceptionController', 'Symfony\Bundle\TwigBundle\Controller\PreviewErrorController']);

parent::setAnnotatedClassCache($annotatedClasses);
}

protected function build(ContainerBuilder $container)
{
$container->register('logger', NullLogger::class);
Expand Down
Expand Up @@ -8,4 +8,3 @@ framework:

twig:
strict_variables: '%kernel.debug%'
exception_controller: null # to be removed in 5.0
Expand Up @@ -7,4 +7,3 @@ framework:

twig:
strict_variables: '%kernel.debug%'
exception_controller: null # to be removed in 5.0
Expand Up @@ -2,4 +2,3 @@
twig:
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
exception_controller: null # to be removed in 5.0
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/TwigBundle/CHANGELOG.md
Expand Up @@ -8,8 +8,8 @@ CHANGELOG
* removed support to load templates from the legacy directories `src/Resources/views/` and `src/Resources/<BundleName>/views/`
* removed `TwigEngine` class, use `Twig\Environment` instead
* removed `FilesystemLoader` and `NativeFilesystemLoader`, use Twig notation for templates instead
* updated default value for the `twig.exception_controller` option to `null`
* removed `ExceptionController` class and all built-in error templates in favor of the new error renderer mechanism
* removed `twig.exception_controller` configuration option, use `framework.error_controller` option instead
* removed `ExceptionController`, `PreviewErrorController` and all built-in error templates in favor of the new error renderer mechanism

4.4.0
-----
Expand Down

This file was deleted.

This file was deleted.

Expand Up @@ -32,14 +32,6 @@ public function getConfigTreeBuilder()
$treeBuilder = new TreeBuilder('twig');
$rootNode = $treeBuilder->getRootNode();

$rootNode
->children()
->scalarNode('exception_controller')
->defaultNull()
->end()
->end()
;

$this->addFormThemesSection($rootNode);
$this->addGlobalsSection($rootNode);
$this->addTwigOptions($rootNode);
Expand Down
Expand Up @@ -70,8 +70,6 @@ public function load(array $configs, ContainerBuilder $container)

$config = $this->processConfiguration($configuration, $configs);

$container->setParameter('twig.exception_listener.controller', $config['exception_controller']);

$container->setParameter('twig.form.resources', $config['form_themes']);
$container->setParameter('twig.default_path', $config['default_path']);
$defaultTwigPath = $container->getParameterBag()->resolveValue($config['default_path']);
Expand Down
12 changes: 0 additions & 12 deletions src/Symfony/Bundle/TwigBundle/Resources/config/routing/errors.xml

This file was deleted.

Expand Up @@ -25,7 +25,6 @@
<xsd:attribute name="charset" type="xsd:string" />
<xsd:attribute name="debug" type="xsd:string" />
<xsd:attribute name="strict-variables" type="xsd:string" />
<xsd:attribute name="exception-controller" type="xsd:string" />
<xsd:attribute name="default-path" type="xsd:string" />
</xsd:complexType>

Expand Down
21 changes: 0 additions & 21 deletions src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
Expand Up @@ -117,27 +117,6 @@
<argument type="service" id="workflow.registry" />
</service>

<service id="twig.exception_listener" class="Symfony\Component\HttpKernel\EventListener\ExceptionListener">
<tag name="kernel.event_subscriber" />
<tag name="monolog.logger" channel="request" />
<argument>%twig.exception_listener.controller%</argument>
<argument type="service" id="logger" on-invalid="null" />
<argument>%kernel.debug%</argument>
<deprecated>The "%service_id%" service is deprecated since Symfony 4.4.</deprecated>
</service>

<service id="twig.controller.exception" class="Symfony\Bundle\TwigBundle\Controller\ExceptionController" public="true">
<argument type="service" id="twig" />
<argument>%kernel.debug%</argument>
<deprecated>The "%service_id%" service is deprecated since Symfony 4.4.</deprecated>
</service>

<service id="twig.controller.preview_error" class="Symfony\Bundle\TwigBundle\Controller\PreviewErrorController" public="true">
<argument type="service" id="http_kernel" />
<argument>%twig.exception_listener.controller%</argument>
<deprecated>The "%service_id%" service is deprecated since Symfony 4.4.</deprecated>
</service>

<service id="twig.configurator.environment" class="Symfony\Bundle\TwigBundle\DependencyInjection\Configurator\EnvironmentConfigurator">
<argument /> <!-- date format, set in TwigExtension -->
<argument /> <!-- interval format, set in TwigExtension -->
Expand Down

This file was deleted.

Expand Up @@ -17,7 +17,6 @@
'charset' => 'ISO-8859-1',
'debug' => true,
'strict_variables' => true,
'exception_controller' => null, // to be removed in 5.0
'default_path' => '%kernel.project_dir%/Fixtures/templates',
'paths' => [
'path1',
Expand Down
Expand Up @@ -6,7 +6,7 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/twig https://symfony.com/schema/dic/twig/twig-1.0.xsd">

<twig:config auto-reload="true" autoescape="true" base-template-class="stdClass" cache="/tmp" charset="ISO-8859-1" debug="true" strict-variables="true" exception-controller="null">
<twig:config auto-reload="true" autoescape="true" base-template-class="stdClass" cache="/tmp" charset="ISO-8859-1" debug="true" strict-variables="true">
<twig:path namespace="namespace3">namespaced_path3</twig:path>
</twig:config>
</container>
Expand Up @@ -6,7 +6,7 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/twig https://symfony.com/schema/dic/twig/twig-1.0.xsd">

<twig:config auto-reload="true" autoescape="true" base-template-class="stdClass" cache="/tmp" charset="ISO-8859-1" debug="true" strict-variables="true" default-path="%kernel.project_dir%/Fixtures/templates" exception-controller="null">
<twig:config auto-reload="true" autoescape="true" base-template-class="stdClass" cache="/tmp" charset="ISO-8859-1" debug="true" strict-variables="true" default-path="%kernel.project_dir%/Fixtures/templates">
<twig:form-theme>MyBundle::form.html.twig</twig:form-theme>
<twig:global key="foo" id="bar" type="service" />
<twig:global key="baz">@@qux</twig:global>
Expand Down
2 changes: 0 additions & 2 deletions src/Symfony/Bundle/TwigBundle/TwigBundle.php
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Bundle\TwigBundle;

use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExceptionListenerPass;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\RuntimeLoaderPass;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass;
Expand All @@ -35,7 +34,6 @@ public function build(ContainerBuilder $container)
$container->addCompilerPass(new ExtensionPass());
$container->addCompilerPass(new TwigEnvironmentPass());
$container->addCompilerPass(new TwigLoaderPass());
$container->addCompilerPass(new ExceptionListenerPass());
$container->addCompilerPass(new RuntimeLoaderPass(), PassConfig::TYPE_BEFORE_REMOVING);
}

Expand Down

0 comments on commit 6651ee9

Please sign in to comment.