Remove Twig_TokenParserBroker (deprecated) + all deprecation warnings #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's a PR that will fix all deprecation warnings including Twig_TokenParserBroker. This should help with (#31 & phpro/grumphp#199).
I've dig some things about the deprecation of the Twig_TokenParserBroker (twigphp/Twig#903). One notable change is that Twig 2.x does not offer a way to dynamically add token parser (like it was done with the Twig_TokenParserBroker). Instead, it just look up an array and throws a syntax error.
https://github.com/twigphp/Twig/blob/2.x/lib/Twig/Parser.php#L148
Therefore, you have to provide the list of tags to stub.
Or via the options of the StubbedEnvironment in the constructor.
This might look like but thinking about it, it makes sense to only allow some tags to be stubbed so that a real "unknown tag" in your code can be detected by the linter.
Additionally, that kind of config would end in the
twigcs.yml
file, see my other PR.