-
-
Notifications
You must be signed in to change notification settings - Fork 494
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
Add support for Twig 3 #1807
Add support for Twig 3 #1807
Conversation
For some reason the tests fail locally because |
|
By the way: $ composer why-not twig/twig 3
sonata-project/formatter-bundle 4.2.0 requires twig/twig (^2.12.1) |
Sorry, what a rookie mistake. Tomorrow I'll see if the formatter bundle can be upgraded. |
It's not rookie at all, I didn't know about that command until I saw it to @greg0ire |
FormatterBundle requires the MediaBundle so there is a circular reference of two bundles requiring twig 2. What's the best approach here? Update one, check the other and then go back and check the first again? |
Do you know if the media-bundle has any dependency with formatter-bundle? I mean, does it have: |
@jordisala1991: no, there is no code reference. In fact, it seems the only place the Formatter Bundle is referenced is to load an additional configuration file called I have removed the dev dependency and Twig 3 is installed now. I have fixed a breakage, but it seems |
|
||
/** | ||
* @final since sonata-project/media-bundle 3.21.0 | ||
*/ | ||
class MediaExtension extends AbstractExtension implements InitRuntimeInterface | ||
class MediaExtension extends AbstractExtension |
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.
BC Break alert
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.
Does this matter? I don't think anyone (should) rely on MediaExtension implements InitRuntimeInterface or not.
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.
Does this matter? I don't think anyone (should) rely on MediaExtension implements InitRuntimeInterface or not.
Think about the result if a user is declaring a method (argument or return) with the removed interface. Does this matter?
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.
InitRuntimeInterface
is part of Twig 2 and removed in Twig 3. If the user refers to InitRuntimeInterface
they can't upgrade to Twig 3.
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.
AFAIK, we aren't dropping the support for twig/twig:2
in this PR.
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.
That's true. The functionality of InitRuntimeInterface can be implemented diffently in a way that works both in Twig 2 and 3. InitRuntimeInterface is only used to inject the Twig\Environment
and I've moved that to the classes in Twig\Node
.
68e5953
to
97403bb
Compare
This PR should target master branch if it contains BC breaks. |
Perhaps I can do something with |
Still TODO: update Nelmio to 3.x
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Subject
It seems Twig 3 support can be enabled without other changes.
I am targeting this branch, because using Twig 3 is backwards compatible.
Changelog
TODO: