This PR was merged into the 4.x branch.
Discussion
----------
Add back the if condition on for loops
Now that the `for` tag implementation has been improved, I think we can add back the `if` condition on `for` loops.
Commits
-------
47d745b7 Add back the if condition on for loops
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
----------
deprecate passing a tag to ImportNode
following #4244
Commits
-------
70396d75 deprecate passing a tag to ImportNode
This PR was merged into the 3.x branch.
Discussion
----------
Deprecate the fact that the `extends` and `use` tags are always allowed in a sandboxed template
Commits
-------
5fca700c Deprecate the fact that the `extends` and `use` tags are always allowed in a sandboxed template
This PR was merged into the 3.x branch.
Discussion
----------
Clarify block function
It actually renders the block again.
Commits
-------
8c3df0c0 Clarify block function
This PR was merged into the 3.x branch.
Discussion
----------
Fix CoreExtension::captureOutput
Fix#4146
I forgot these lines in #4216
Commits
-------
7ba68667 Fix CoreExtension::captureOutput
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Mark implicit macro argument default values as such with an attribute in AST
This change causes no difference to compiled templates or to macro argument semantics.
Consider the following macro:
```twig
{% macro marco(po, lo = null) %}{% endmacro %}
```
With this change, the `ConstantExpression` for argument `po` will have an attribute `is_implicit`, whose value will be `true`. (Note that `lo` will not have that attribute.)
This allows node visitors to distinguish between arguments that do and those that do not have explicit default values even if the value is `null`.
This is useful for [static code analysis](https://github.com/twigphp/Twig/issues/4003).
For example, a static analysis tool might consider arguments with no explicit default value as non-optional.
Commits
-------
e83a8028 Mark implicit macro argument default values as such with an attribute in AST
This PR was merged into the 3.x branch.
Discussion
----------
Fix two-word tests precedence over one-word tests
Closes#3282
Commits
-------
58d5780e Fix two-word tests precedence over one-word tests
This PR was merged into the 4.x branch.
Discussion
----------
Use proper node names when they are integers
Commits
-------
cde9e7dc Use proper node names when they are integers
This PR was merged into the 3.x branch.
Discussion
----------
Deprecate the spaceless filter
Closes#3576
Deprecate the `spaceless` filter for the following reasons:
* The performance is bad (as the work is done at runtime via a regexp)
* Optimizing the size of an HTML doc server side is "almost never" a good idea (compression is better and enough)
* There are some edge cases where you want to keep some spaces (see #3576)
* Controlling whitespace is possible and fine-grained via the dedicated Twig modifiers on `{{ }}`
If someone find it useful, re-creating it is trivial (`return trim(preg_replace('/>\s+</', '><', $content ?? ''));`),
but with so many caveats and not so many use cases, I think it does not belong to core.
Commits
-------
9fd4c487 Deprecate the spaceless filter
* 3.x:
Deprecate some internal methods from Parser
Move code from ExtendsTokenParser to Parser
Update Node::__toString() to include the node tag if set
Fix class name
Fix error message
This PR was merged into the 3.x branch.
Discussion
----------
Deprecate some internal methods from Parser
Commits
-------
9e6c4a6a Deprecate some internal methods from Parser
This PR was merged into the 3.x branch.
Discussion
----------
Move code from ExtendsTokenParser to Parser
Commits
-------
cf472760 Move code from ExtendsTokenParser to Parser
This PR was merged into the 3.x branch.
Discussion
----------
Update Node::__toString() to include the node tag if set
Commits
-------
157d36ae Update Node::__toString() to include the node tag if set