This PR was merged into the 3.x branch.
Discussion
----------
Add the notion of a Twig callable
Commits
-------
84bc23af Add the notion of a Twig callable
This PR was merged into the 3.x branch.
Discussion
----------
Drop support for 8.0
The most recent version of PHP 7 (7.4) was deprecated more than a year and a half ago.
We won't remove code that supports PHP 7 (as this has already been done in 4.x and there is no point in redoing the work in the 3.x branch), but we will use some new PHP 8 features in the 3.x branch from now on.
Commits
-------
c070cd71 Drop support for 8.0
This PR was merged into the 3.x branch.
Discussion
----------
Add a note about how to escape a string interpolation in a string
Commits
-------
38e47a3e Add a note about how to escape a string interpolation in a string
This PR was merged into the 3.x branch.
Discussion
----------
Implement the enum_cases function
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.
Closes#3872 (it replaces it)
Relates to #3681 (it solves the case of getting the list of cases)
Note that the strict compile time validation for string literals is especially beneficial as long as escaping `\` is mandatory in our string literals (where escaping non-special characters is the same than not putting the backslash) as by experience, this is a common mistake when trying to put a PHP FQCN in a Twig string. One of the tests I added is covering exactly this kind of mistake.
Commits
-------
ff4d01f9 Implement the enum_cases function
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 merged into the 3.x branch.
Discussion
----------
Fix integration tests when a test has more than on data/expect section and deprecations
Fixes#4186
As deprecations are emitted at compile time, we need to make sure templates are always compiled even when we have more than one data/expect section (in which case the templates are the same). The trick here is to add some whitespace at the end of the template.
Commits
-------
a5dc02bb Fix integration tests when a test has more than on data/expect section and deprecations
This PR was merged into the 3.x branch.
Discussion
----------
Add the possibility to deprecate attributes and nodes on Node
Commits
-------
18894cf9 Add the possibility to deprecate attributes and nodes on Node
This PR was merged into the 3.x branch.
Discussion
----------
Add support for package/version on deprecations
Commits
-------
0ce79df5 Use trigger_deprecation() instead of trigger_error() for deprecations
This PR was merged into the 3.x branch.
Discussion
----------
Move static attributes for Function|Filter|TestExpression to the constructor
Commits
-------
e8141bbd Move static attributes for Function|Filter|TestExpression to the constructor
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`
This PR was merged into the 3.x branch.
Discussion
----------
Introduce ChainCache and ReadOnlyFilesystemCache
Following the feedback in symfony/symfony#54384, I’m proposing the two new Cache implementations in Twig directly.
Commits
-------
0dbe1d9f Introduce ChainCache and ReadOnlyFilesystemCache
This PR was merged into the 3.x branch.
Discussion
----------
Add a note about how macros can override existing functions
Commits
-------
cea17143 Add a note about how macros can override existing functions
This PR was merged into the 3.x branch.
Discussion
----------
Fix dumping callables on Node::__toString()
Closes#3694
Commits
-------
fc644721 Fix dumping callables on Node::__toString()
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Add new "find" filter
This filter returns the first _value_ matching the given arrow function or null
Attempt to solve #3962
(open to any feedback)
Commits
-------
4e262511 Add new "find" filter
This PR was merged into the 3.x branch.
Discussion
----------
Remove the templateClassPrefix property on Environment
Commits
-------
215f9880 Remove the templateClassPrefix property on Environment
This PR was merged into the 3.x branch.
Discussion
----------
[Tests] Fix EscaperRuntime namespace
From `Twig\Tests` to `Twig\Tests\Runtime`
Commits
-------
df4e66f4 Fix EscaperRuntime namespace