Backward incompatibilities:
* The short notation of the `block` tag changed.
+ * changed the generated code to match the new coding standards
* fixed sandbox mode (__toString() method check was not enforced if called implicitly from a simple statement like {{ article }})
* added a 'as' string to the block tag short notation ({% block title "Title" %} must now be {% block title as "Title" %})
* added an exception when a child template has a non-empty body (as it is always ignored when rendering)
{
$strings = func_get_args();
foreach ($strings as $string) {
- $this->source .= str_repeat(' ', $this->indentation * 2).$string;
+ $this->source .= str_repeat(' ', $this->indentation * 4).$string;
}
return $this;
$compiler->addDebugInfo($this);
$compiler
- ->write("if (\$this->env->isDebug())\n", "{\n")
+ ->write("if (\$this->env->isDebug()) {\n")
->indent()
->write('var_export(')
;
->repr($loopVars[0])
->raw("] => \$context[")
->repr($loopVars[1])
- ->raw("])\n")
- ->write("{\n")
+ ->raw("]) {\n")
->indent()
;
if ($idx++) {
$compiler
->outdent()
- ->write("}\n", "elseif (")
+ ->write("} elseif (")
;
} else {
$compiler
$compiler
->subcompile($test[0])
- ->raw(")\n")
- ->write("{\n")
+ ->raw(") {\n")
->indent()
->subcompile($test[1])
;
if (!is_null($this->else)) {
$compiler
->outdent()
- ->write("}\n", "else\n", "{\n")
+ ->write("} else {\n")
->indent()
->subcompile($this->else)
;
->raw(");\n\n")
->write("if (!class_exists(")
->string($compiler->getTemplateClass($this->macro).'_Macro')
- ->raw("))\n")
- ->write("{\n")
+ ->raw(")) {\n")
->indent()
->write(sprintf("throw new InvalidArgumentException('There is no defined macros in template \"%s\".');\n", $this->macro))
->outdent()
if ($this->sandboxed) {
$compiler
- ->write("if (!\$alreadySandboxed)\n", "{\n")
+ ->write("if (!\$alreadySandboxed) {\n")
->indent()
->write("\$sandbox->disableSandbox();\n")
->outdent()
->addDebugInfo($this)
->write('if ($this->env->hasExtension(\'sandbox\') && is_object(')
->subcompile($this->expr)
- ->raw('))'."\n")
- ->write('{'."\n")
+ ->raw(')) {'."\n")
->indent()
->write('$this->env->getExtension(\'sandbox\')->checkMethodAllowed(')
->subcompile($this->expr)