Bump Twig to version ^2.9 in order to use apply spaceless filter instead of the deprecated spaceless tag.
Will that mean dropping the ^1.34 part, or bumping it too?
@greg0ire
The spaceless filter was added in Twig 1.38.
The apply tag was added in Twig 2.9. (we might not want that yet)
so if we would use just the spaceless filter, we could just use it as filer
or we could just add our own apply tag in case the one from twig is not defined?
The "problem" with using just the filter without the apply tag is that the syntax which are covered by the filter must be basically a string, and we are wrapping complex structures now:
https://github.com/sonata-project/SonataAdminBundle/blob/64b83e290566dc609a7a30d6a419c1359430dfc9/src/Resources/views/CRUD/action_buttons.html.twig#L11-L17
How about just dropping Twig 1? Twig 2 is one year old now, I think people have had plenty of time to migrate.
Yes, that is what I'm proposing. But we need the constraint ^2.9 instead ^2.0 if we want to just replace {% spaceless %} with {% apply spaceless %}. Otherwise, we need to find an alternative solution for the complex syntaxes (writing our own apply bridge tag or restructuring the templates).
Sounds acceptable to me.
Let鈥檚 drop Twig 1
Could we also update the constraint "^1.34 || ^2.0" to "^1.41 || ^2.0" at 3.x branch in order to have the filter filter available? This is required to fix #5575.
Oh I thought you were actually targetting 3.x in your PR, didn't check that, please edit the target, rebase and force push, I don't think there is a BC-break in your changes, is there?
I think dropping the support for Twig 1.x is a BC break for users which are using that version by their own requirements, since it will make SonataAdmin not installable for them.
it will make SonataAdmin not installable for them.
It will make SonataAdmin not upgradable for them. They will still be able to install older versions.
Of course. If that is not a problem, I'll change the target.
That's something we avoid to do with Symfony or Php, but I think for Twig it might be OK.
Most helpful comment
Let鈥檚 drop Twig 1