function BlockNode::compile
Overrides Node::compile
File
-
vendor/
twig/ twig/ src/ Node/ BlockNode.php, line 31
Class
- BlockNode
- Represents a block node.
Namespace
Twig\NodeCode
public function compile(Compiler $compiler) : void {
$compiler->addDebugInfo($this)
->write("/**\n")
->write(" * @return iterable<null|scalar|\\Stringable>\n")
->write(" */\n")
->write(\sprintf("public function block_%s(array \$context, array \$blocks = []): iterable\n", $this->getAttribute('name')), "{\n")
->indent()
->write("\$macros = \$this->macros;\n");
$compiler->subcompile($this->getNode('body'))
->write("yield from [];\n")
->outdent()
->write("}\n\n");
}