Skip to content

Conversation

@nstapelbroek
Copy link
Contributor

Hi again! 👋

I thought I'd get rid of the deprecation notice in the twig bundle while building for Symfony 4. Note that this is a behavioral change: the default value is 'false' compared to the new default value of '%kernel.debug%' which eventually evaluates to true when running the tests. Since it seems that this configuration is only used in the functional tests, there should be nothing functionally breaking in the bundle.

But, what does strict_variables do?

If set to false, Twig will silently ignore invalid variables (variables and or attributes/methods that do not exist) and replace them with a null value. When set to true, Twig throws an exception instead. - Twig documentation

What has been changed?

  • In order to suppress the twig deprecation warnings, I've set the strict_variables: setting to "%kernel.debug%"

How to test:

28x: 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.

Notes:

This PR is build upon the assumption that the line causing deprecation warnings was only used for functional testing.

This is a behavioural change: the default value is 'false' compared to the new default value of '%kernel.debug%' which eventually evaluates to true when running the tests.
Since it seems that this configuration is only used in the functional tests, there should be nothing functionally breaking in the bundle
@Nyholm
Copy link
Member

Nyholm commented Jun 26, 2018

Excellent. But why couldn't we set the value to true instead?

@Nyholm
Copy link
Member

Nyholm commented Jun 26, 2018

Ah, okey. Because %kernel.debug% is the new default.

Perfect then. Thank you!

@Nyholm Nyholm merged commit 9bf308c into php-translation:master Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants