* 3.x:
Bump actions/cache for CI
Remove an obsolete comment
Throws proper Twig exception when using cycle on an empty array
Add tests when a template doesn't have output nodes
Optimize TextNodes
Remove list() usage in code
Remove usage of list() in favor of []
This PR was merged into the 3.x branch.
Discussion
----------
Throws proper Twig exception when using cycle on an empty array
Closes#3925
Commits
-------
d21666f7 Throws proper Twig exception when using cycle on an empty array
This PR was merged into the 3.x branch.
Discussion
----------
Optimize TextNodes
Not a great perf optimization, but it makes the node graph simpler which helps when we need to debug templates.
Commits
-------
c44bd1ff Optimize TextNodes
This PR was merged into the 3.x branch.
Discussion
----------
Add tests when a template doesn't have output nodes
refs #3950 cc `@smnandre`
Commits
-------
d53509d4 Add tests when a template doesn't have output nodes
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Remove usage of list() in favor of []
Commits
-------
af8ec178 Remove list() usage in code
9c0897fa Remove usage of list() in favor of []
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
rework the CaptureNode implementation
fixes#3955
Commits
-------
665dce89 rework the CaptureNode implementation
This PR was merged into the 3.x branch.
Discussion
----------
Abstract node capture in its own Node
To prepare the work for #3950, I'd like to abstract the usage of `echo` into a single node that can be reused by other nodes.
The cache node is a good example of defining something that is more semantic are reusable as well. The node itself now just generates the wrapper that can then be returned, echoed, yielded, ...
Commits
-------
6ebbc305 Abstract node capture in its own Node
This PR was merged into the 4.x branch.
Discussion
----------
Remove usage of ReturnTypeWillChange
Commits
-------
13e57cb3 Remove usage of ReturnTypeWillChange
This PR was merged into the 3.x branch.
Discussion
----------
Improve error message for `constant(FQCN::class)`
It is not obvious that you cannot use the Twig function `constant` to get the special `::class` constants of classes like so: `{{ constant('Twig\\Extension\\CoreExtension::class') }}`, due to the underlying PHP function `\constant()`.
The previous error message
> Constant "Twig\Extension\CoreExtension::class" is undefined.
was generally helpful, but in this special case it was a bit misleading.
An alternative might be to determine and return the FCQN (e.g. via `substr($constant, 0, -7)`), but I'm not sure if this would be too much of a guess.
Commits
-------
3963851a Improve error message
It is not obvious that you cannot use the Twig function `constant` to get the special `::class` constants of classes like so: `{{ constant('Twig\\Extension\\CoreExtension::class') }}`, due to the underlying PHP function `\constant()`.
The previous error message in this case: 'Constant "Twig\Extension\CoreExtension::class" is undefined.' was not very helpful.
This PR was merged into the 3.x branch.
Discussion
----------
Simplify code when using `ob_*` functions
And fixed an edge case (see the modified test).
Commits
-------
0b9e30e3 Simplify code
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Simplify sandbox tests
This allows to remove some unneeded assertions and fix static analysis checks.
Commits
-------
bc22e38c Fix bad merge
e6a98a00 Fix test without any assertions
fca89954 Simplify tests
This PR was squashed before being merged into the 2.x branch.
Discussion
----------
Add SourcePolicyInterface to selectively enable the Sandbox based on a template's Source
This is needed to patch some downstream vulnerabilities which I won't describe here.
I wrote `@fabpot` an email about this with more details a few weeks ago.
Generally the Sandbox can be enabled for a given template in either of two ways:
* Globally
* Including the template from another template in which we use the sandbox tag or parameter
This pull request adds a third way
* Using a SourcePolicy to selectively sandbox templates based on their Source object
Commits
-------
a18da161 Add SourcePolicyInterface to selectively enable the Sandbox based on a template's Source
This PR was merged into the 4.x branch.
Discussion
----------
Add type hints to private properties
Commits
-------
35640b6d Add type hints to private properties