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
* 3.x:
Fix CS
Move functions for CoreExtension
Move functions for EscaperExtension
Move functions for StringLoaderExtension
Move functions for DebugExtension
Move functions for MarkdownExtension
Move functions for InkyExtension
Move functions for CssInlinerExtension
Move functions for HtmlExtension
Deprecate internal extension functions in favor of methods on the extension classes
Tweak deprecated docs
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Deprecate internal extension functions in favor of methods on the extension classes
~~PoC on a simple extension for now.~~
Commits
-------
aa7c454e Fix CS
54d34b96 Move functions for CoreExtension
72071e8e Move functions for EscaperExtension
196e91dd Move functions for StringLoaderExtension
d4d01603 Move functions for DebugExtension
69a89e0e Move functions for MarkdownExtension
e07e9b5b Move functions for InkyExtension
bff189f1 Move functions for CssInlinerExtension
6a18cda5 Move functions for HtmlExtension
16abb69d Deprecate internal extension functions in favor of methods on the extension classes