mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-04 02:47:14 +00:00
Stop looking up a macro twice in its own namespace when it is declared by a parent
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user