Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
theme system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Feb 2014 at 04:01 UTC
Updated:
17 Nov 2015 at 12:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
cosmicdreams commentedComment #2
cosmicdreams commentedComment #4
tatarbjI'm on it.
Comment #5
tatarbjI've rescaned the whole core and looked throuth all of places of using of Twig_NodeInterface class. Because just the Twig_Node class extends this interface, i think in all of place when used the parent class we can use the implemented class, and the Twig_NodeIntercase will be deprecated we have to use the Twig_Node in all of our codes. This patch replaces all of Twig_NodeInterface to Twig_Node in codes and documentations.
Comment #6
tatarbjComment #7
cosmicdreams commentedIt appears that the changes you made were overly aggressive. You shouldn't modify the imported libraries of Assetic or Twig. If those changes need to made they should be contributed as upstream patches.
Comment #8
cosmicdreams commentedHere's a patch that attempts to modify only the files within Drupal.
Comment #10
tatarbjI think if the Twig_NodeInterface class is a deprecated that means the concrate calls of this will be wrong if once will be deleted, so we have to modify the code not just in the drupal core but in assetics and the twig classes, otherwise our patches will be failed. So i think the comment #5 is a good solution for that problem.
Comment #11
cosmicdreams commentedThis likely means that we need to postpone this issue until we can resolve the upstream issues. As noted above we are not allowed to make changes to external libraries within the scope of Drupal development. If we did, those changes would be overwritten whenever we would update those external libraries anyway so there isn't a point in updating those external libraries anyway.
That would be like hacking core when you're making a module.
Comment #12
star-szr@cosmicdreams is correct, the patch in #8 is indeed much closer to what we'd need in core to solve this issue. See also #2228743: Replace deprecated Twig_CompilerInterface, Twig_LexerInterface and Twig_ParserInterface with recommended classes.
Comment #13
star-szr8: 2194155_8.patch queued for re-testing.
Comment #15
star-szrJust want to note that these changes are included in #2568181: [META] Update to Twig 2.x in Drupal 9, so this might end up being a duplicate.
It might be a good novice task to just create a new patch (create a new patch, don't try to reroll) that applies and see what the testbot thinks (see if any tests fail). Just to see if we could commit this separately potentially. But just a forewarning that it's very possible nothing will get committed here. Even still it could be good practice for rolling patches :)
Comment #16
star-szrMaking this a child issue of #2568181: [META] Update to Twig 2.x in Drupal 9 per #2568181-45: [META] Update to Twig 2.x in Drupal 9.
Comment #17
cosmicdreams commentedCool to see this issue come back to life. Did a quick check on the state of core and it seems that only 3 files need to be changed, all in drupal/core/lib/Drupal/Core/Template/TwigNodeVisitor.php
drupal/core/lib/Drupal/Core/Template/TwigTransTokenParser.php
drupal/core/lib/Drupal/Core/Template/TwigNodeTrans.php
The only problem with the changes in drupal/core/lib/Drupal/Core/Template/TwigNodeVisitor.php which implements an interface that expects Twig_NodeInterace to type the variables used in enterNode() and leaveNode()
I've uploaded two patches one that will likely fail and one that will work to illustrate.
Comment #18
cosmicdreams commentedComment #20
subhojit777Comment #21
subhojit777Then I guess it should be moved to needs work.
Comment #22
cosmicdreams commentedIt appears that this is the proper solution for removing ALL of the Twig_NodeInterface references :
http://symfony.com/blog/twig-how-to-upgrade-to-2-0-deprecation-notices-t...
Cottser has a patch that does this work in #2568181: [META] Update to Twig 2.x in Drupal 9, but it looks like they want to split that issue into easy to commit parts.
So let's do that work here.
Comment #23
subhojit777Comment #24
star-szrThis is almost certainly RC target per #2568181-45: [META] Update to Twig 2.x in Drupal 9, back to 8.0.x.
Out of scope change, please remove. Thanks!
Comment #25
star-szrComment #26
star-szrComment #27
star-szrShouldn't this be 'extends' instead of 'implements'? \Twig_BaseNodeVisitor is an abstract class, not an interface.
We should be changing these to protected methods per the interface.
Comment #28
xjmThanks for tagging this for rc target triage! To have committers consider it for inclusion in RC, add a statement to the issue summary of why we need to make this change during RC, including what happens if we do not make the change and what any disruptions from it are. You can add a section
<h3>Why this should be an RC target</h3>to the summary.In this case, it can probably just quote @effulgentsia's comment on the other issue. :)
Comment #29
star-szrThanks @xjm!
Comment #30
subhojit777This covers #24 and #27.1
@Cottser can you clarify #27.2? Thanks.
Comment #31
star-szrJust summarizing some discussion from IRC here for reference:
The \Twig_BaseNodeVisitor base class makes enterNode and leaveNode from the interface that we were previously implementing final to make sure that the nodes passed in are instances of \Twig_Node and then calls doEnterNode and doLeaveNode respectively. So when we extend that base class we are implementing the do* methods and those are protected on the base class so it makes sense to keep them protected.
Hopefully that makes some sense, it's late.
Comment #32
subhojit777Thanks @Cottser ;)
Comment #33
star-szrThanks @subhojit777, this looks good now! Updates all our usages and doesn't touch vendor.
Comment #36
alexpott@catch and I agree we should be ready for Twig 2.0
Comment #37
alexpottCommitted 65dd859 and pushed to 8.0.x. Thanks!