This PR was squashed before being merged into the 1.x branch (closes#2882).
Discussion
----------
Environment class cleanup 1.x
Commits
-------
8ab10798 simplified code
e2103c87 use load() instead of loadTemplate() in tests
c82d7dca added the possibility to pass a TemplateWrapper to Twig\Environment::load()
This PR was squashed before being merged into the 1.x branch (closes#2879).
Discussion
----------
Try to avoid guessing template info on errors
Right now, for syntax errors triggered in a Node, we guess the template line and source, but we then try to set the information in the Parser class. This PR avoids the guessing as it's slow.
Commits
-------
69c0539c removed -2 magic number
2389faea tried to avoid guessing template info on errors
This PR was merged into the 1.x branch.
Discussion
----------
document support for defining default argument values in the macro tag
The `macro` tag documentation reads
> Macros differ from native PHP functions in a few ways:
> - Default argument values are defined by using the default filter in the macro body
and provides the example
```twig
{% macro input(name, value, type, size) %}
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
{% endmacro %}
```
The implication is that native PHP function-like default argument value definition is not supported.
v1.12 added support for
```twig
{% macro input1(name, value, type = 'text', size = 20) %}
<input type="{{ type }}" name="{{ name }}" value="{{ value|e }}" size="{{ size }}" />
{% endmacro %}
```
This updates the documentation to cover both ways of defining default argument values.
Commits
-------
40c7553a document support for defining default argument values in the macro tag
* 1.x:
do not check sandbox for __toString if method does not exist on object
tweaked sandbox generated code
fixed indentation of the compiled template
This PR was merged into the 2.x branch.
Discussion
----------
Fix deprecation notes
`ExpressionParser` still uses `since version [...]` because the message is not only about Twig: any package providing extensions can trigger it.
Commits
-------
0f8d66be Fix deprecation notes
This PR was merged into the 2.x branch.
Discussion
----------
Remove runtime deprecation that prevent smooth update
This deprecation is already triggered when a class that implements `InitRuntimeInterface` is loaded.
This runtime deprecation prevents creating a continuous upgrade path.
Commits
-------
8f9fe276 Remove runtime deprecation that prevent smooth update
This PR was merged into the 1.x branch.
Discussion
----------
Improve the performance of the sandbox
Commits
-------
5c661869 improved the performance of the sandbox
* 1.x:
Revert "re-implemented the spaceless tag to reuse the filter tag logic"
fixed CS
re-implemented the spaceless tag to reuse the filter tag logic
added a spaceless filter
removed unneeded usage of spaceless in tests
This PR was squashed before being merged into the 1.x branch (closes#2872).
Discussion
----------
Add spaceless filter
Commits
-------
a22a5c4b fixed CS
743767bc re-implemented the spaceless tag to reuse the filter tag logic
b823898e added a spaceless filter
1ba79416 removed unneeded usage of spaceless in tests