fix: #4033 add missing unwrap call when a TemplateWrapper instance can be present

This commit is contained in:
Gildas de Cadoudal
2024-04-18 11:47:39 +02:00
parent 7d2b814e6c
commit 6c6315263e
3 changed files with 22 additions and 3 deletions
+2 -2
View File
@@ -198,7 +198,7 @@ final class ModuleNode extends Node
->raw(', ')
->repr($node->getTemplateLine())
->raw(");\n")
->write(sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i))
->write(sprintf("if (!\$_trait_%s->unwrap()->isTraitable()) {\n", $i))
->indent()
->write("throw new RuntimeError('Template \"'.")
->subcompile($trait->getNode('template'))
@@ -207,7 +207,7 @@ final class ModuleNode extends Node
->raw(", \$this->source);\n")
->outdent()
->write("}\n")
->write(sprintf("\$_trait_%s_blocks = \$_trait_%s->getBlocks();\n\n", $i, $i))
->write(sprintf("\$_trait_%s_blocks = \$_trait_%s->unwrap()->getBlocks();\n\n", $i, $i))
;
foreach ($trait->getNode('targets') as $key => $value) {