Merge branch '2.x' into 3.x

* 2.x:
  removed wrong link in docs
  fixed doc markup
  optimized context access on PHP 7.4
This commit is contained in:
Fabien Potencier
2019-04-30 15:02:09 +02:00
3 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -242,7 +242,7 @@
* 1.40.2 (2019-XX-XX)
* n/a
* optimized context access on PHP 7.4
* 1.40.1 (2019-04-29)
+1 -1
View File
@@ -800,7 +800,7 @@ The following operators don't fit into any of the other categories:
{# returns the value of foo if it is defined and not null, 'no' otherwise #}
{{ foo ?? 'no' }}
.. _templates-string-interpolation
.. _templates-string-interpolation:
String Interpolation
~~~~~~~~~~~~~~~~~~~~
+8 -1
View File
@@ -36,13 +36,20 @@ class NameExpression extends AbstractExpression
if ($this->getAttribute('is_defined_test')) {
if ($this->isSpecial()) {
$compiler->repr(true);
} elseif (\PHP_VERSION_ID >= 700400) {
$compiler
->raw('array_key_exists(')
->string($name)
->raw(', $context)')
;
} else {
$compiler
->raw('(isset($context[')
->string($name)
->raw(']) || array_key_exists(')
->string($name)
->raw(', $context))');
->raw(', $context))')
;
}
} elseif ($this->isSpecial()) {
$compiler->raw($this->specialVars[$name]);