diff --git a/CHANGELOG b/CHANGELOG index a6e7a9365..e604e7397 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -199,7 +199,7 @@ * removed Parser::isReservedMacroName() * removed SanboxedPrintNode * removed Node::setTemplateName() - * made classes maked as "@final" final + * made classes marked as "@final" final * removed InitRuntimeInterface, ExistsLoaderInterface, and SourceContextLoaderInterface * removed the "spaceless" tag * removed Twig\Environment::getBaseTemplateClass() and Twig\Environment::setBaseTemplateClass() diff --git a/src/Node/CaptureNode.php b/src/Node/CaptureNode.php index 27ae4c605..561e1ea53 100644 --- a/src/Node/CaptureNode.php +++ b/src/Node/CaptureNode.php @@ -34,7 +34,7 @@ class CaptureNode extends Node if (!$this->getAttribute('raw')) { $compiler->raw("('' === \$tmp = "); } - $compiler->raw($useYield ? "implode('', iterator_to_array(" : "\\Twig\\Extension\\CoreExtension::captureOutput("); + $compiler->raw($useYield ? "implode('', iterator_to_array(" : '\\Twig\\Extension\\CoreExtension::captureOutput('); if ($this->getAttribute('with_blocks')) { $compiler->raw("(function () use (&\$context, \$macros, \$blocks) {\n"); } else { diff --git a/src/Template.php b/src/Template.php index bb8146a2c..f31333240 100644 --- a/src/Template.php +++ b/src/Template.php @@ -342,6 +342,7 @@ abstract class Template try { if ($this->useYield) { yield from $this->doDisplay($context, $blocks); + return; } @@ -411,6 +412,7 @@ abstract class Template try { if ($this->useYield) { yield from $template->$block($context, $blocks); + return; } diff --git a/tests/Node/BlockTest.php b/tests/Node/BlockTest.php index 280a95cba..0938e74a1 100644 --- a/tests/Node/BlockTest.php +++ b/tests/Node/BlockTest.php @@ -14,7 +14,6 @@ namespace Twig\Tests\Node; use Twig\Environment; use Twig\Loader\ArrayLoader; use Twig\Node\BlockNode; -use Twig\Node\Node; use Twig\Node\TextNode; use Twig\Test\NodeTestCase;