Remove usage of ob_* functions in favor of yielding

This commit is contained in:
Fabien Potencier
2024-01-25 13:09:52 +01:00
parent 594c548b92
commit 3b6cbf98d8
30 changed files with 657 additions and 78 deletions
+11 -4
View File
@@ -28,9 +28,16 @@ class BlockReferenceNode extends Node implements NodeOutputInterface
public function compile(Compiler $compiler): void
{
$compiler
->addDebugInfo($this)
->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name')))
;
if ($compiler->getEnvironment()->useYield()) {
$compiler
->addDebugInfo($this)
->write(sprintf("yield from \$this->unwrap()->yieldBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name')))
;
} else {
$compiler
->addDebugInfo($this)
->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name')))
;
}
}
}