Skip to content

Commit 0d62f32

Browse files
committed
minor #31664 [TwigBundle] Remove default value deprecation for twig.strict_variables option (yceruto)
This PR was merged into the 5.0-dev branch. Discussion ---------- [TwigBundle] Remove default value deprecation for twig.strict_variables option | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - See previous PR in 4.1 #25780 Commits ------- 8320737 Remove default value deprecation for twig.strict_variables
2 parents bc7783c + 8320737 commit 0d62f32

17 files changed

+8
-56
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,7 @@ private function addTwigOptions(ArrayNodeDefinition $rootNode)
128128
->scalarNode('cache')->defaultValue('%kernel.cache_dir%/twig')->end()
129129
->scalarNode('charset')->defaultValue('%kernel.charset%')->end()
130130
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
131-
->booleanNode('strict_variables')
132-
->defaultValue(function () {
133-
@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);
134-
135-
return false;
136-
})
137-
->end()
131+
->booleanNode('strict_variables')->defaultValue('%kernel.debug%')->end()
138132
->scalarNode('auto_reload')->end()
139133
->integerNode('optimizations')->min(-1)->end()
140134
->scalarNode('default_path')

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class ConfigurationTest extends TestCase
2020
public function testDoNoDuplicateDefaultFormResources()
2121
{
2222
$input = [
23-
'strict_variables' => false, // to be removed in 5.0 relying on default
2423
'form_themes' => ['form_div_layout.html.twig'],
2524
];
2625

@@ -30,22 +29,9 @@ public function testDoNoDuplicateDefaultFormResources()
3029
$this->assertEquals(['form_div_layout.html.twig'], $config['form_themes']);
3130
}
3231

33-
/**
34-
* @group legacy
35-
* @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.
36-
*/
37-
public function testGetStrictVariablesDefaultFalse()
38-
{
39-
$processor = new Processor();
40-
$config = $processor->processConfiguration(new Configuration(), [[]]);
41-
42-
$this->assertFalse($config['strict_variables']);
43-
}
44-
4532
public function testGlobalsAreNotNormalized()
4633
{
4734
$input = [
48-
'strict_variables' => false, // to be removed in 5.0 relying on default
4935
'globals' => ['some-global' => true],
5036
];
5137

@@ -58,7 +44,6 @@ public function testGlobalsAreNotNormalized()
5844
public function testArrayKeysInGlobalsAreNotNormalized()
5945
{
6046
$input = [
61-
'strict_variables' => false, // to be removed in 5.0 relying on default
6247
'globals' => ['global' => ['some-key' => 'some-value']],
6348
];
6449

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/customTemplateEscapingGuesser.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
$container->loadFromExtension('twig', [
44
'autoescape_service' => 'my_project.some_bundle.template_escaping_guesser',
55
'autoescape_service_method' => 'guess',
6-
'strict_variables' => false, // to be removed in 5.0 relying on default
76
]);
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<?php
22

3-
$container->loadFromExtension('twig', [
4-
'strict_variables' => false, // to be removed in 5.0 relying on default
5-
]);
3+
$container->loadFromExtension('twig');

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/extra.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
'paths' => [
55
'namespaced_path3' => 'namespace3',
66
],
7-
'strict_variables' => false, // to be removed in 5.0 relying on default
87
]);

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/formats.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@
1111
'decimal_point' => ',',
1212
'thousands_separator' => '.',
1313
],
14-
'strict_variables' => false, // to be removed in 5.0 relying on default
1514
]);

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/customTemplateEscapingGuesser.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
77
http://symfony.com/schema/dic/twig https://symfony.com/schema/dic/twig/twig-1.0.xsd">
88

9-
<twig:config autoescape-service="my_project.some_bundle.template_escaping_guesser" autoescape-service-method="guess" strict-variables="false" />
9+
<twig:config autoescape-service="my_project.some_bundle.template_escaping_guesser" autoescape-service-method="guess" />
1010
</container>

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/empty.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
77
http://symfony.com/schema/dic/twig https://symfony.com/schema/dic/twig/twig-1.0.xsd">
88

9-
<twig:config strict-variables="false" />
9+
<twig:config />
1010
</container>

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/formats.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
66
http://symfony.com/schema/dic/twig https://symfony.com/schema/dic/twig/twig-1.0.xsd">
77

8-
<twig:config strict-variables="false">
8+
<twig:config>
99
<twig:date format="Y-m-d" interval-format="%d" timezone="Europe/Berlin" />
1010
<twig:number-format decimals="2" decimal-point="," thousands-separator="." />
1111
</twig:config>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
twig:
22
autoescape_service: my_project.some_bundle.template_escaping_guesser
33
autoescape_service_method: guess
4-
strict_variables: false # to be removed in 5.0 relying on default

0 commit comments

Comments
 (0)