From e3f0d6fb4cd24aafb0d756166781db2715eddd92 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 25 Sep 2026 07:34:36 +0200 Subject: [PATCH] Stop looking up a macro twice in its own namespace when it is declared by a parent --- src/MacroNamespace.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MacroNamespace.php b/src/MacroNamespace.php index 13ca706bc..cd9ac06fc 100644 --- a/src/MacroNamespace.php +++ b/src/MacroNamespace.php @@ -57,7 +57,7 @@ final class MacroNamespace return $macro->callLegacy($arguments, $source, $line); } - if (null === $macro = $this->resolve($name, $context)) { + if (null === $macro = $this->getParent($context)?->resolve($name, $context)) { if (!str_starts_with($name, 'macro_') || null === $macro = $this->resolve($bareName = substr($name, \strlen('macro_')), $context)) { throw new RuntimeError(\sprintf('Macro "%s" is not defined in template "%s".', $name, $this->template->getTemplateName()), $line, $source); }