@@ -187,7 +187,7 @@ public function macroElse(MacroNode $node, PhpWriter $writer): string
187187 }
188188 $ node ->validate (false , ['if ' , 'ifset ' , 'foreach ' , 'ifchanged ' , 'try ' , 'first ' , 'last ' , 'sep ' ]);
189189
190- $ parent = $ node ->parentNode ;
190+ $ parent = $ node ->getParentMacroNode () ;
191191 if (isset ($ parent ->data ->else )) {
192192 throw new CompileException ('Tag ' . $ parent ->getNotation () . ' may only contain one {else} clause. ' );
193193 }
@@ -220,7 +220,7 @@ public function macroElse(MacroNode $node, PhpWriter $writer): string
220220 public function macroElseIf (MacroNode $ node , PhpWriter $ writer ): string
221221 {
222222 $ node ->validate (true , ['if ' , 'ifset ' ]);
223- if (isset ($ node ->parentNode ->data ->else ) || !empty ($ node ->parentNode ->data ->capture )) {
223+ if (isset ($ node ->getParentMacroNode () ->data ->else ) || !empty ($ node ->getParentMacroNode () ->data ->capture )) {
224224 throw new CompileException ('Tag ' . $ node ->getNotation () . ' is unexpected here. ' );
225225 }
226226
@@ -547,8 +547,8 @@ public function macroBreakContinueIf(MacroNode $node, PhpWriter $writer): string
547547 }
548548 $ node ->validate ('condition ' );
549549
550- if ($ node ->parentNode ->prefix === $ node ::PREFIX_NONE ) {
551- return $ writer ->write ("if (%node.args) %node.line { echo \"</ {$ node ->parentNode ->htmlNode ->name }> \\n \"; $ cmd; } " );
550+ if ($ node ->getParentMacroNode () ->prefix === $ node ::PREFIX_NONE ) {
551+ return $ writer ->write ("if (%node.args) %node.line { echo \"</ {$ node ->getParentMacroNode () ->htmlNode ->name }> \\n \"; $ cmd; } " );
552552 }
553553 return $ writer ->write ("if (%node.args) %node.line $ cmd; " );
554554 }
@@ -651,7 +651,7 @@ public function macroDebugbreak(MacroNode $node, PhpWriter $writer): string
651651 public function macroCase (MacroNode $ node , PhpWriter $ writer ): string
652652 {
653653 $ node ->validate (true , ['switch ' ]);
654- if (isset ($ node ->parentNode ->data ->default )) {
654+ if (isset ($ node ->getParentMacroNode () ->data ->default )) {
655655 throw new CompileException ('Tag {default} must follow after {case} clause. ' );
656656 }
657657 return $ writer ->write ('} elseif (in_array($ʟ_switch, %node.array, true)) %node.line { ' );
@@ -665,12 +665,16 @@ public function macroCase(MacroNode $node, PhpWriter $writer): string
665665 */
666666 public function macroVar (MacroNode $ node , PhpWriter $ writer ): string
667667 {
668- if ($ node ->name === 'default ' && $ node ->parentNode && $ node ->parentNode ->name === 'switch ' ) {
668+ if (
669+ $ node ->name === 'default '
670+ && $ node ->getParentMacroNode ()
671+ && $ node ->getParentMacroNode ()->name === 'switch '
672+ ) {
669673 $ node ->validate (false , ['switch ' ]);
670- if (isset ($ node ->parentNode ->data ->default )) {
674+ if (isset ($ node ->getParentMacroNode () ->data ->default )) {
671675 throw new CompileException ('Tag {switch} may only contain one {default} clause. ' );
672676 }
673- $ node ->parentNode ->data ->default = true ;
677+ $ node ->getParentMacroNode () ->data ->default = true ;
674678 return $ writer ->write ('} else %node.line { ' );
675679
676680 } elseif ($ node ->modifiers ) {
0 commit comments