* 1.11.0 (2012-XX-XX)
+ * fixed macro compilation when a variable name is a PHP reserved keyword
* changed the date filter behavior to always apply the default timezone, except if false is passed as the timezone
* fixed bitwise operator precedences
* added the template_from_string function
{
$arguments = array();
foreach ($this->getNode('arguments') as $argument) {
- $arguments[] = '$'.$argument->getAttribute('name').' = null';
+ $arguments[] = '$_'.$argument->getAttribute('name').' = null';
}
$compiler
$compiler
->write('')
->string($argument->getAttribute('name'))
- ->raw(' => $'.$argument->getAttribute('name'))
+ ->raw(' => $_'.$argument->getAttribute('name'))
->raw(",\n")
;
}
--- /dev/null
+--TEST--
+macro
+--TEMPLATE--
+{% from _self import test %}
+
+{% macro test(this) -%}
+ {{ this }}
+{%- endmacro %}
+
+{{ test(this) }}
+--DATA--
+return array('this' => 'foo');
+--EXPECT--
+foo
return array(
array($node, <<<EOF
// line 1
-public function getfoo(\$foo = null)
+public function getfoo(\$_foo = null)
{
\$context = \$this->env->mergeGlobals(array(
- "foo" => \$foo,
+ "foo" => \$_foo,
));
\$blocks = array();