Fix null coalescing operator with imported macros

This commit is contained in:
Fabien Potencier
2026-02-25 07:47:34 +01:00
parent 206ad9f1a8
commit efa004caab
2 changed files with 47 additions and 0 deletions
@@ -29,6 +29,16 @@ class MacroReferenceExpression extends AbstractExpression implements SupportDefi
parent::__construct(['template' => $template, 'arguments' => $arguments], ['name' => $name], $lineno);
}
public function __clone()
{
// The template node must not be deep-cloned because its name is
// lazily generated during compilation and must stay in sync with
// the AssignTemplateVariable that populates the $macros array.
$template = $this->nodes['template'];
parent::__clone();
$this->nodes['template'] = $template;
}
public function compile(Compiler $compiler): void
{
if ($this->definedTest) {