Problem/Motivation
Quoting @alexpott from #3041076-44: Update Drupal 9 to Twig 2:
There's not much we can do about the
The "Twig\Environment::getTemplateClass()" method is considered internal. It may change without further notice. You should not extend it from "Drupal\Core\Template\TwigEnvironment".over than remove \Drupal\Core\Template\TwigEnvironment::getTemplateClass() which exists for performance reasons. I guess we could try to get the perf improvement upstream.
#1979290: Add static caching to Twig_Environment::getTemplateClass() overrode \Drupal\Core\Template\TwigEnvironment::getTemplateClass() as a performance improvement.
Then @Cottser pointed out in #3041076-47: Update Drupal 9 to Twig 2:
Regarding getTemplateClass please see this old upstream issue: https://github.com/twigphp/Twig/pull/1071
Followed by @alexpott in #3041076-48: Update Drupal 9 to Twig 2:
So upstream tried this and it broke stuff - that's useful info. I don't know how we're going to solve the
The "Twig\Environment::getTemplateClass()" method is considered internal. It may change without further notice. You should not extend it from "Drupal\Core\Template\TwigEnvironment".deprecation. But I'm not sure that that matters for getting Twig2 done. Maybe I'll try a PR to remove the @internal or add a flag to enable this caching.
Proposed resolution
TBD
Remaining tasks
Investigate how we can add an upstream feature that allows us to remove this Drupal-specific performance optimization
User interface changes
None.
API changes
TBD
Data model changes
None.
Release notes snippet
TBD
Comments
Comment #2
wim leersComment #5
wim leersOh, cool, upstream already tried this and it broke. Updating issue summary.
Also crediting @alexpott & @Cottser.