This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes#2769).
Discussion
----------
Update .travis.yml
Commits
-------
721fb3f6 Update .travis.yml
This PR was merged into the 2.x branch.
Discussion
----------
Remove mention of the Twig C extension
As per #2318 there's no additional installation methods so it should be removed from the intro page.
Commits
-------
434589bd Remove mention of the Twig C extension
This PR was merged into the 1.x branch.
Discussion
----------
Make sure twig_include returns a string
Currently returns `null` if `$ignoreMissing` is `true` and it's not found, but the return type is `string`.
Commits
-------
a55f76bf Make sure twig_include returns a string
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes#2764).
Discussion
----------
Document combining JSON constants
Working out how to do this took a Slack conversation and a StackOverflow answer. I'm adding ti to the documentation so others can get the answer immediately.
Apologies for any reST errors, it's been 10+ years since I wrote any.
Commits
-------
7f4ecd66 Document combining JSON constants
This PR was merged into the 1.x branch.
Discussion
----------
Improved the code of an example
The original code contains an unneeded *"pop culture"* reference. For those unaware of it, it contains two strong words ("kill" and "bastard").
The concern about this example was firstly raised in the `#diversity` channel of [Symfony Slack](https://symfony.com/support).
Commits
-------
f07a876d Improved the code of an example
This PR was merged into the 2.x branch.
Discussion
----------
Fix multi-byte UFT-8 in escape('html_attr')
Alternative to #2734
Commits
-------
dc3acfb7 Fix multi-byte UFT-8 in escape('html_attr')
This PR was merged into the 1.x branch.
Discussion
----------
Fix multi-byte UFT-8 in escape('html_attr')
same as #2750 but on 1.x
Commits
-------
8863b68c Fix multi-byte UFT-8 in escape('html_attr')
This PR was merged into the 1.x branch.
Discussion
----------
[RFC] Added new "deprecated" tag
```twig
{% deprecated 'The message...' %}
```
This new tag would allow us to define a deprecation warning anywhere within a template, useful for Frameworks, bundles, etc. where breaking the BC is frequently when templates are involved.
It will be easy to guarantee a smooth migration path when we want e.g. rename/remove a template or block, as well as displaying an accurate depreciation message.
**Deprecating a whole template `{# base.twig #}`**
```twig
{% deprecated 'The "' ~ _self ~ '" template is deprecated, use "layout.twig" instead' %}
{% extends 'layout.twig' %}
```
If we're extending from this template `{% extends 'base.twig' %}` then:
```
The "base.twig" template is deprecated, use "layout.twig" instead ("base.twig" at line 1).
```
**Deprecating a block {# greeting/blocks.twig #}**
```twig
{% block hey %}
{% deprecated 'The "hey" block is deprecated, use "greet" block instead' %}
{{ block('greet') }}
{% endblock %}
{% block greet %}
Hey you!
{% endblock %}
```
If we're using this block `{{ block('hey') }}` then:
```
The "hey" block is deprecated, use "greet" block instead ("greeting/blocks.twig" at line 2).
```
also other examples come from my mind like deprecating macros, and any other extension point.
Commits
-------
2ab43383 Added "deprecated" tag
This PR was squashed before being merged into the 1.x branch (closes#2730).
Discussion
----------
Add support for dynamic tests
fixes#2589
Commits
-------
4beb7bfb Add support for dynamic tests
This PR was merged into the 1.x branch.
Discussion
----------
Fix GlobalsInterface extends for IDE
Commits
-------
0b819abb Fix GlobalsInterface extends for IDE
This PR was merged into the 1.x branch.
Discussion
----------
Use isset before array_key_exists
Small performance improvment when using
```
{% set foo = foo|default("bar") %}
```
Will render the following code
```
$context["foo"] = (((isset($context["foo"]) || array_key_exists("foo", $context))) ? (_twig_default_filter((isset($context["foo"]) || array_key_exists("foo", $context) ? $context["foo"] : (function () { throw new Twig_Error_Runtime('Variable "foo" does not exist.', 1, $this->source); })()), "bar")) : ("bar"));
```
instead of
```
$context["foo"] = ((array_key_exists("foo", $context)) ? (_twig_default_filter((isset($context["foo"]) || array_key_exists("foo", $context) ? $context["foo"] : (function () { throw new Twig_Error_Runtime('Variable "foo" does not exist.', 1, $this->source); })()), "bar")) : ("bar"));
```
Commits
-------
230d3412 Use isset before array_key_exists
This PR was merged into the 2.x branch.
Discussion
----------
Fix the error handling for the optimized extension-based function calls
Triggering a Twig_Error_Runtime at compile-time breaks the contract of the Twig environment, as such exception is for errors during the rendering.
This moves back the exception to a runtime one (same behavior than before the optimization).
Another option would be to replace this with a `Twig_Error_Syntax` instead (reporting the error earlier), but that would change the exception being thrown for such case.
Commits
-------
9928ae14 Fix the error handling for the optimized extension-based function calls
This PR was merged into the 2.x branch.
Discussion
----------
Report the proper location for errors compiled in templates
The `{% use %}` and `{% with %}` tags are adding some runtime checks triggering exceptions in the compiled template. This ensures that they get the proper location.
While the guessing was generally working fine for the `{% with %}` (and so this only makes the code faster), the guessing was not working for `{% use %}` due to the exception happening in the class constructor rather than on display (and so the guessing was finding the template which was triggering the load of the faulty template).
Commits
-------
e4423576 Report the proper location for errors compiled in templates