Fabien Potencier 0f45c2a677 minor #2710 Use isset before array_key_exists (jderusse)
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
2018-06-25 15:41:18 +02:00
2018-05-30 21:54:04 +02:00
2018-03-20 05:26:35 +01:00
2018-01-07 18:54:25 +01:00
2018-04-20 07:23:43 +02:00

Twig, the flexible, fast, and secure template language for PHP
==============================================================

Twig is a template language for PHP, released under the new BSD license (code
and documentation).

Twig uses a syntax similar to the Django and Jinja template languages which
inspired the Twig runtime environment.

More Information
----------------

Read the `documentation`_ for more information.

.. _documentation: https://twig.symfony.com/documentation
Languages
PHP 99.9%