From 83207370cbc4d4ab9c49b8ee2eae8d8ab934231c Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Tue, 28 May 2019 15:39:08 -0400 Subject: [PATCH] Remove default value deprecation for twig.strict_variables --- .../DependencyInjection/Configuration.php | 8 +------- .../DependencyInjection/ConfigurationTest.php | 15 --------------- .../php/customTemplateEscapingGuesser.php | 1 - .../DependencyInjection/Fixtures/php/empty.php | 4 +--- .../DependencyInjection/Fixtures/php/extra.php | 1 - .../DependencyInjection/Fixtures/php/formats.php | 1 - .../xml/customTemplateEscapingGuesser.xml | 2 +- .../DependencyInjection/Fixtures/xml/empty.xml | 2 +- .../DependencyInjection/Fixtures/xml/formats.xml | 2 +- .../yml/customTemplateEscapingGuesser.yml | 1 - .../DependencyInjection/Fixtures/yml/empty.yml | 1 - .../DependencyInjection/Fixtures/yml/extra.yml | 1 - .../DependencyInjection/Fixtures/yml/formats.yml | 1 - .../DependencyInjection/TwigExtensionTest.php | 13 +++---------- .../Tests/Functional/CacheWarmingTest.php | 3 --- .../TwigBundle/Tests/Functional/EmptyAppTest.php | 7 ------- .../Tests/Functional/NoTemplatingEntryTest.php | 1 - 17 files changed, 8 insertions(+), 56 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php index b635a752ab..7cb0225989 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php @@ -128,13 +128,7 @@ class Configuration implements ConfigurationInterface ->scalarNode('cache')->defaultValue('%kernel.cache_dir%/twig')->end() ->scalarNode('charset')->defaultValue('%kernel.charset%')->end() ->booleanNode('debug')->defaultValue('%kernel.debug%')->end() - ->booleanNode('strict_variables') - ->defaultValue(function () { - @trigger_error('Relying on the default value ("false") of the "twig.strict_variables" configuration option is deprecated since Symfony 4.1. You should use "%kernel.debug%" explicitly instead, which will be the new default in 5.0.', E_USER_DEPRECATED); - - return false; - }) - ->end() + ->booleanNode('strict_variables')->defaultValue('%kernel.debug%')->end() ->scalarNode('auto_reload')->end() ->integerNode('optimizations')->min(-1)->end() ->scalarNode('default_path') diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php index e479804b98..41627c4804 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -20,7 +20,6 @@ class ConfigurationTest extends TestCase public function testDoNoDuplicateDefaultFormResources() { $input = [ - 'strict_variables' => false, // to be removed in 5.0 relying on default 'form_themes' => ['form_div_layout.html.twig'], ]; @@ -30,22 +29,9 @@ class ConfigurationTest extends TestCase $this->assertEquals(['form_div_layout.html.twig'], $config['form_themes']); } - /** - * @group legacy - * @expectedDeprecation Relying on the default value ("false") of the "twig.strict_variables" configuration option is deprecated since Symfony 4.1. You should use "%kernel.debug%" explicitly instead, which will be the new default in 5.0. - */ - public function testGetStrictVariablesDefaultFalse() - { - $processor = new Processor(); - $config = $processor->processConfiguration(new Configuration(), [[]]); - - $this->assertFalse($config['strict_variables']); - } - public function testGlobalsAreNotNormalized() { $input = [ - 'strict_variables' => false, // to be removed in 5.0 relying on default 'globals' => ['some-global' => true], ]; @@ -58,7 +44,6 @@ class ConfigurationTest extends TestCase public function testArrayKeysInGlobalsAreNotNormalized() { $input = [ - 'strict_variables' => false, // to be removed in 5.0 relying on default 'globals' => ['global' => ['some-key' => 'some-value']], ]; diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/customTemplateEscapingGuesser.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/customTemplateEscapingGuesser.php index de55467d22..c9acb3c253 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/customTemplateEscapingGuesser.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/customTemplateEscapingGuesser.php @@ -3,5 +3,4 @@ $container->loadFromExtension('twig', [ 'autoescape_service' => 'my_project.some_bundle.template_escaping_guesser', 'autoescape_service_method' => 'guess', - 'strict_variables' => false, // to be removed in 5.0 relying on default ]); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/empty.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/empty.php index 76e66160f5..0236f4ff55 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/empty.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/empty.php @@ -1,5 +1,3 @@ loadFromExtension('twig', [ - 'strict_variables' => false, // to be removed in 5.0 relying on default -]); +$container->loadFromExtension('twig'); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/extra.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/extra.php index 30c3428ef1..0143514f69 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/extra.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/extra.php @@ -4,5 +4,4 @@ $container->loadFromExtension('twig', [ 'paths' => [ 'namespaced_path3' => 'namespace3', ], - 'strict_variables' => false, // to be removed in 5.0 relying on default ]); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/formats.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/formats.php index 69fbf7c012..7e85738809 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/formats.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/formats.php @@ -11,5 +11,4 @@ $container->loadFromExtension('twig', [ 'decimal_point' => ',', 'thousands_separator' => '.', ], - 'strict_variables' => false, // to be removed in 5.0 relying on default ]); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/customTemplateEscapingGuesser.xml b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/customTemplateEscapingGuesser.xml index 63c851720c..f72bed9d14 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/customTemplateEscapingGuesser.xml +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/customTemplateEscapingGuesser.xml @@ -6,5 +6,5 @@ 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"> - + diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/empty.xml b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/empty.xml index ffe2f52577..f3b51fa242 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/empty.xml +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/empty.xml @@ -6,5 +6,5 @@ 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"> - + diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/formats.xml b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/formats.xml index 7f8fb84357..fa888b30ac 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/formats.xml +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/formats.xml @@ -5,7 +5,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"> - + diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/customTemplateEscapingGuesser.yml b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/customTemplateEscapingGuesser.yml index 34e301c095..eb26e7165b 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/customTemplateEscapingGuesser.yml +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/customTemplateEscapingGuesser.yml @@ -1,4 +1,3 @@ twig: autoescape_service: my_project.some_bundle.template_escaping_guesser autoescape_service_method: guess - strict_variables: false # to be removed in 5.0 relying on default diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/empty.yml b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/empty.yml index 9b5dbcf35b..a472b2698e 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/empty.yml +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/empty.yml @@ -1,2 +1 @@ twig: - strict_variables: false # to be removed in 5.0 relying on default diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/extra.yml b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/extra.yml index 41a281cc81..3c5e6a3b59 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/extra.yml +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/extra.yml @@ -1,4 +1,3 @@ twig: - strict_variables: false # to be removed in 5.0 relying on default paths: namespaced_path3: namespace3 diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/formats.yml b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/formats.yml index a5c57f383e..290921630f 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/formats.yml +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/formats.yml @@ -1,5 +1,4 @@ twig: - strict_variables: false # to be removed in 5.0 relying on default date: format: Y-m-d interval_format: '%d' diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 1057540dcc..7b3595e93c 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -29,9 +29,7 @@ class TwigExtensionTest extends TestCase { $container = $this->createContainer(); $container->registerExtension(new TwigExtension()); - $container->loadFromExtension('twig', [ - 'strict_variables' => false, // to be removed in 5.0 relying on default - ]); + $container->loadFromExtension('twig'); $this->compileContainer($container); $this->assertEquals('Twig\Environment', $container->getDefinition('twig')->getClass(), '->load() loads the twig.xml file'); @@ -155,7 +153,6 @@ class TwigExtensionTest extends TestCase $container->registerExtension(new TwigExtension()); $container->loadFromExtension('twig', [ 'globals' => $globals, - 'strict_variables' => false, // // to be removed in 5.0 relying on default ]); $this->compileContainer($container); @@ -257,9 +254,7 @@ class TwigExtensionTest extends TestCase $container->register('debug.stopwatch', 'Symfony\Component\Stopwatch\Stopwatch'); } $container->registerExtension(new TwigExtension()); - $container->loadFromExtension('twig', [ - 'strict_variables' => false, // to be removed in 5.0 relying on default - ]); + $container->loadFromExtension('twig'); $container->setAlias('test.twig.extension.debug.stopwatch', 'twig.extension.debug.stopwatch')->setPublic(true); $this->compileContainer($container); @@ -287,9 +282,7 @@ class TwigExtensionTest extends TestCase { $container = $this->createContainer(); $container->registerExtension(new TwigExtension()); - $container->loadFromExtension('twig', [ - 'strict_variables' => false, // to be removed in 5.0 relying on default - ]); + $container->loadFromExtension('twig'); $container->setParameter('kernel.environment', 'test'); $container->setParameter('debug.file_link_format', 'test'); $container->setParameter('foo', 'FooClass'); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php index ca21df0902..66b31a1a09 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php @@ -97,9 +97,6 @@ class CacheWarmingKernel extends Kernel 'secret' => '$ecret', 'form' => ['enabled' => false], ]) - ->loadFromExtension('twig', [ // to be removed in 5.0 relying on default - 'strict_variables' => false, - ]) ; }); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/EmptyAppTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/EmptyAppTest.php index df90b23752..86d933b558 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/EmptyAppTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/EmptyAppTest.php @@ -37,13 +37,6 @@ class EmptyAppKernel extends Kernel public function registerContainerConfiguration(LoaderInterface $loader) { - $loader->load(function ($container) { - $container - ->loadFromExtension('twig', [ // to be removed in 5.0 relying on default - 'strict_variables' => false, - ]) - ; - }); } public function getCacheDir() diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php index f1e7709072..9a45c25ba3 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php @@ -67,7 +67,6 @@ class NoTemplatingEntryKernel extends Kernel 'form' => ['enabled' => false], ]) ->loadFromExtension('twig', [ - 'strict_variables' => false, // to be removed in 5.0 relying on default 'default_path' => __DIR__.'/templates', ]) ;