This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Add return type `isTraitable`
I'd like to do this for more methods that are exposed in the compiled code. This will ease static analysis as there are less errors that are coming from Twig.
This is just a first small PR to see if this is acceptable 😊
Commits
-------
bb8b9c19 Add return type `isTraitable`
This PR was merged into the 3.x branch.
Discussion
----------
Only unset loop when with_loop
Even though PHP does not complain, PHPStan does.
> Cannot unset offset 'loop' on array{ ... the context values ... }
Since this is compiled code, we can easily produce a bit more valid code in the eyes of PHPStan.
Commits
-------
42245310 Only unset loop when with_loop
This PR was merged into the 3.x branch.
Discussion
----------
Update a phpdoc (ModuleNode is final now)
Commits
-------
313303b3 Update a phpdoc (ModuleNode is final now)
The implementation contains an optimized implementation of the function
for the common case of using a string literal as the argument. It will
validate the enum existence during compilation and compile the code to
use `MyEnum::cases()` directly.
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Constant expr as final
Closes#4119
Commits
-------
230e31d3 Add a recipe about how to mark a node as safe
693693ba Mark ConstantExpression as `@final`
Deprecate two methods from NameExpression:
* isSimple(): did not find any usage in Twig (or even Symfony) repositories
* isSpecial(): inlined for better performance ($name is available in the method)
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Fix blocks not available under some circumstancies
Fix#4079
Commits
-------
55ae2149 Add more tests
d30b72c3 Fix blocks not available under some circumstancies