-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[TwigBundle] Deprecating "false" in favor of "kernel.debug" as default value of "strict_variable" #25780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👍 Status: reviewed |
BC break? Should be in a recipe instead? |
OH, it's already in a recipe, and the doc was accurate when starting with the standard edition, isn't it? |
Standard Edition has always explicitly defined it, see 2.7 @ https://github.com/symfony/symfony-standard/blob/2.7/app/config/config.yml#L36. So given that all "supported" standard editions and the Flex recipe default it correctly we're only "BC breaking" people that explicitly removed it to fall back to a value that was documented to be identical to the default. Even if somebody actually did that (why?!?) they were expecting it to do this as documented ( Imho that's a very hard case to call a "BC break". |
Agree with @curry684, this BC break is very weird, however we can do something to solve it, right? |
Yes we can: we just need to deprecate not setting the option. |
4bdf431
to
85b6115
Compare
->booleanNode('strict_variables')->end() | ||
->booleanNode('strict_variables') | ||
->defaultValue(function () { | ||
@trigger_error('No setting "strict_variables" to false is deprecated as of 4.1, it will be the value of the "kernel.debug" parameter by default in 5.0.', E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolas-grekas done, but I'm not completely sure if the numbers are correct: 4.1
... 5.0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, is it the right way to do it? How can I avoid the deprecation notices in tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would need to configure a value explicitly instead of relying on the default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @xabbuh, I've made the changes, but in some places it seems out of place, so we need to remember remove it relying on the default value again in 5.0. The question is: how to remember that? i.e. what is the common practice in this case? adding a direct comment to the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the past, we often added inline comments like "to be removed when ..." (at least, I used this phrase a lot to search for code that could be removed when we started the development on 4.0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline comments added, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are now using is deprecated as of Symfony 4.1
34b158c
to
9cd4637
Compare
Well, first step completed! Status: Needs Review |
5509b63
to
1141a8a
Compare
Modified deprecation message. Status: Needs Review |
->booleanNode('strict_variables')->end() | ||
->booleanNode('strict_variables') | ||
->defaultValue(function () { | ||
@trigger_error('Setting by default the "strict_variables" option to "false" under "twig" configuration is deprecated as of Symfony 4.1, it will be by default the value of the "kernel.debug" parameter in 5.0.', E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with nicolas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, done, thanks!
1141a8a
to
4f74801
Compare
'namespaced_path3' => 'namespace3', | ||
), | ||
'paths' => array( | ||
'namespaced_path3' => 'namespace3', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation of this line needs to be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks.
4f74801
to
19f30e2
Compare
@yceruto Can you please also update the |
4dd428e
to
9572ebd
Compare
65db960
to
922878e
Compare
Should be ready now. |
Thank you @yceruto. |
…ebug" as default value of "strict_variable" (yceruto) This PR was merged into the 4.1-dev branch. Discussion ---------- [TwigBundle] Deprecating "false" in favor of "kernel.debug" as default value of "strict_variable" | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - > http://symfony.com/doc/current/reference/configuration/twig.html#strict-variables >**strict_variables** > **type**: boolean **default**: `'%kernel.debug%'` Nope, really it's `false` by default: https://github.com/symfony/symfony/blob/1df45e43563a37633b50d4a36478090361a0b9de/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php#L130 Fixing it in symfony/symfony-docs#9050, but yes `'%kernel.debug%'` is a better default value, the [TwigBundle recipe](https://github.com/symfony/recipes/blob/bf2148f9f1fe5af7e19c3145b6f7246c6cabb3a5/symfony/twig-bundle/3.3/config/packages/twig.yaml#L4:) affirms that: ```yaml twig: # ... strict_variables: '%kernel.debug%' ``` So yeah, it definitely looks like it should be the default value, wdyt? Commits ------- 922878e Deprecating "false" as default value of "strict_variable" under Twig configuration
…trict_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 symfony/symfony#25780 Commits ------- 83207370cb Remove default value deprecation for twig.strict_variables
…trict_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
Nope, really it's
false
by default:symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
Line 130 in 1df45e4
Fixing it in symfony/symfony-docs#9050, but yes
'%kernel.debug%'
is a better default value, the TwigBundle recipe affirms that:So yeah, it definitely looks like it should be the default value, wdyt?