This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Add more types to Template class and compiled templates
Similar to https://github.com/twigphp/Twig/pull/4250.
Commits
-------
7e52a680 Add more types to Template class and compiled templates
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Document how to iterate over a string
Commits
-------
2f8c6218 Fix doc markup
a68804d6 Add an example on how to iterate over a string
This PR was merged into the 3.x branch.
Discussion
----------
Remove NodeCaptureInterface from TypesNode
This was accidentally copied from SetNode
Commits
-------
5e3f9d9f Remove NodeCaptureInterface from TypesNode
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Use CPP in full code base
Commits
-------
28923f42 Use CPP in full code base
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Add types tag
The is a draft implementation for #4165.
Commits
-------
67dabd81 Add types tag
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Add conditional return types to `ensureTraversable`
This way, static analyzers can understand what the output of this call will be.
Commits
-------
956d09bf Add conditional return types to `ensureTraversable`
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
----------
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 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
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