Skip to content

Commit c1c3f0d

Browse files
committed
Revert "TASK: Reduce mental thinking complexity for $attributeTranspiler ??= new AttributeTranspiler("
As discussed here: bf0f15f#r1172400387 We do want the attributeTranspiler to be instantiated lazily, as the goal is > Never instantiate a transpiler class, unless its transpile-method is guaranteed to be called This reverts commit bf0f15f.
1 parent bf0f15f commit c1c3f0d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/Target/Php/Transpiler/Tag/TagTranspiler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ public function transpile(TagNode $tagNode): string
3939
{
4040
$result = sprintf('<%s', $tagNode->tagName);
4141

42-
$attributeTranspiler = new AttributeTranspiler(
43-
scope: $this->scope
44-
);
45-
42+
$attributeTranspiler = null;
4643
foreach ($tagNode->attributes->items as $attribute) {
44+
$attributeTranspiler ??= new AttributeTranspiler(
45+
scope: $this->scope
46+
);
4747
$result .= ' ' . $attributeTranspiler->transpile($attribute);
4848
}
4949

0 commit comments

Comments
 (0)