-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
marked some Twig_Environment methods as being internal #1889
Conversation
66e842c
to
12689eb
Compare
Assetic relies on |
@stof any news on this one? |
I haven't worked on Assetic again. I will need to do it (I forgot about this discussion) |
@fabpot I did the change in Assetic (was even easier than I though actually). See the PR linked above |
12689eb
to
ec80345
Compare
ec80345
to
212730a
Compare
Thanks @stof |
…(fabpot) This PR was merged into the 1.x branch. Discussion ---------- marked some Twig_Environment methods as being internal This PR marks some `Twig_Environment` methods as being internals: * `getFunctions()`, `getFilters()`, `getTests()`, `getFunction()`, `getFilter()`, `getTest()`, `getTokenParsers()`, `getTags()`, `getNodeVisitors()`, `getUnaryOperators()`, `getBinaryOperators()` because I don't see how they can be used in any useful way and anyway, `getFunctions()` and `getFilters()` do not return all possible functions or filters. Moreover, I think that all this logic could be refactored and moved into its own class for 2.0 (could be done by deprecating those existing methods in 1.x if we agree to merge this PR). * `getGlobals()` because it should only be called in a runtime context, not in a compilation one (so limiting its usage to internal use only allows for better control of usage). * `initGlobals()`, `initExtensions()`, `initExtension()` because they are private in Twig 2.0. Commits ------- 212730a marked some Twig_Environment methods as being internal
…tic functions (stof) This PR was merged into the 1.4-dev branch. Discussion ---------- Avoid using Twig_Environment::getFunction to identify Assetic functions As of Assetic 1.3.0, the Twig functions are using a special node class, which can be used to identify them instead. The `getFunction` method is intended to be marked as an internal one in twigphp/Twig#1889 Commits ------- 39b99e8 Avoid using Twig_Environment::getFunction to identify Assetic functions
This PR was squashed before being merged into the 3.0.x-dev branch. Discussion ---------- imagine_filter fail when lazy mode is enabled Hi everybody ! The problem occurs when I use the VichImageType and its form widget associated. This line `ea_apply_filter_if_exists('imagine_filter', formTypeOptions.imagine_pattern)` fail. I got the error `Non-static method Liip\ImagineBundle\Templating\LazyFilterRuntime::filter() cannot be called statically` when liip_imagine is configurered in lazy mode ```yaml # liip_imagine.yaml liip_imagine: twig: mode: 'lazy' ``` Everything works very well if this mode is disabled. You can reproduce that problem with the current version of Symfony ( 5.3 ) with php 8. Just a more complex problem, getFilter is marked as internal by Twig twigphp/Twig#1889 So, we shouldn't use it... but I don't see how to avoid it :-/ I also changed the strict comparison, because on version 2 getFilter can return false but on version 3 it can return null. Thanks a lot for your review :) Commits ------- bb2f839 imagine_filter fail when lazy mode is enabled
I'm working own a custom twig lexer in order to lint twig files and I need to access the unary operator and the binary operator of the TwigEnvironnement, in order to do a similar logic than the Twig Lexer Those methods are internal, and are just doing
Would it be ok to remove |
Please open a dedicated discussion instead of commenting on a PR that was merged almost 7 years ago. |
This PR marks some
Twig_Environment
methods as being internals:getFunctions()
,getFilters()
,getTests()
,getFunction()
,getFilter()
,getTest()
,getTokenParsers()
,getTags()
,getNodeVisitors()
,getUnaryOperators()
,getBinaryOperators()
because I don't see how they can be used in any useful way and anyway,getFunctions()
andgetFilters()
do not return all possible functions or filters. Moreover, I think that all this logic could be refactored and moved into its own class for 2.0 (could be done by deprecating those existing methods in 1.x if we agree to merge this PR).getGlobals()
because it should only be called in a runtime context, not in a compilation one (so limiting its usage to internal use only allows for better control of usage).initGlobals()
,initExtensions()
,initExtension()
because they are private in Twig 2.0.