Skip to content
Permalink
Browse files

BlockMacros: block name must not start with underscore [Closes #193]

  • Loading branch information...
dg committed Aug 5, 2019
1 parent aced71d commit bca314ef23e524c9b06e9ba73c52258596c927bc
Showing with 7 additions and 0 deletions.
  1. +3 −0 src/Latte/Macros/BlockMacros.php
  2. +4 −0 tests/Latte/BlockMacros.block5.phpt
@@ -268,6 +268,9 @@ public function macroBlock(MacroNode $node, PhpWriter $writer)
return "\$this->checkBlockContentType($blockType, $fname);"
. "\$this->blockQueue[$fname][] = [\$this, '{$node->data->func}'];";
}
} elseif ($name[0] === '_') {
throw new CompileException("Block name '$name' must not start with an underscore.");
}
// static snippet/snippetArea
@@ -26,3 +26,7 @@ Assert::match(
'<br class="123">',
$latte->renderToString('{block test}<br n:class="$var">{/block}', ['var' => 123])
);
Assert::exception(function () use ($latte) {
$latte->renderToString('{define _foobar}Hello{/define}');
}, Latte\CompileException::class, "Block name '_foobar' must not start with an underscore.");

0 comments on commit bca314e

Please sign in to comment.
You can’t perform that action at this time.