function Template::yield
Return value
iterable<scalar|\Stringable|null>
2 calls to Template::yield()
- Template::display in vendor/
twig/ twig/ src/ Template.php - Template::render in vendor/
twig/ twig/ src/ Template.php
File
-
vendor/
twig/ twig/ src/ Template.php, line 381
Class
- Template
- Default base class for compiled templates.
Namespace
TwigCode
public function yield(array $context, array $blocks = []) : iterable {
$context += $this->env
->getGlobals();
$blocks = array_merge($this->blocks, $blocks);
try {
yield from $this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Throwable $e) {
$e = new RuntimeError(\sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}