Skip to content

Commit ed3f6a2

Browse files
committed
Move FormatterModifier after TransModifier and ListModifier
Positioning FormatterModifier later in the chain allows TransModifier and ListModifier to handle their specific pipes first. Since FormatterModifier attempts to create a formatter for any pipe it encounters, this change avoids unnecessary formatter creation attempts for known modifiers like `|trans` and `|list`, improving performance. Assisted-by: OpenCode (GLM-4.7)
1 parent f730ef0 commit ed3f6a2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/PlaceholderFormatter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
/** @param array<string, mixed> $parameters */
2626
public function __construct(
2727
private array $parameters,
28-
private Modifier $modifier = new FormatterModifier(
29-
new TransModifier(
30-
new ListModifier(new StringPassthroughModifier(new StringifyModifier())),
28+
private Modifier $modifier = new TransModifier(
29+
new ListModifier(
30+
new FormatterModifier(new StringPassthroughModifier(new StringifyModifier())),
3131
),
3232
),
3333
) {

0 commit comments

Comments
 (0)