Skip to content

Commit df1d4d4

Browse files
committed
chore(view): mago fmt
1 parent dfbb2f9 commit df1d4d4

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

packages/view/src/Attributes/ApplyAttribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ public static function renderAll(ImmutableArray|array $attributes): string
8585

8686
return implode(' ', $parts);
8787
}
88-
}
88+
}

packages/view/src/Elements/ViewComponentElement.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ private function compileComponent(): ImmutableString
189189
// If the component template itself uses :apply= anywhere, the developer is controlling
190190
// attribute spreading manually. If :apply was set at the call site, all attributes are
191191
// forwarded explicitly via the merged $attributes array. Either way, skip auto-fallthrough.
192-
$skipFallthrough = str_contains($this->viewComponent->contents, ':apply=')
193-
|| $this->applyExpression !== null;
192+
$skipFallthrough = str_contains($this->viewComponent->contents, ':apply=') || $this->applyExpression !== null;
194193

195194
$tokens = TempestViewParser::ast($this->viewComponent->contents);
196195

@@ -205,10 +204,8 @@ private function compileComponent(): ImmutableString
205204
// A valid fallthrough target is the first real HTML open or self-closing tag
206205
// that is not x-slot. SELF_CLOSING_TAG covers bare no-attribute forms like <div/>.
207206
// OPEN_TAG_START covers everything else, including <div class="foo" />.
208-
$shouldApplyFallthrough = ! $fallthroughApplied
209-
&& ! $skipFallthrough
210-
&& in_array($token->type, [TokenType::OPEN_TAG_START, TokenType::SELF_CLOSING_TAG], true)
211-
&& $token->tag !== 'x-slot';
207+
$shouldApplyFallthrough =
208+
! $fallthroughApplied && ! $skipFallthrough && in_array($token->type, [TokenType::OPEN_TAG_START, TokenType::SELF_CLOSING_TAG], true) && $token->tag !== 'x-slot';
212209

213210
if (! $shouldApplyFallthrough) {
214211
$buffer .= $this->compileTokens(tokens: [$token]);
@@ -464,4 +461,4 @@ public function getImports(): array
464461

465462
return $imports;
466463
}
467-
}
464+
}

packages/view/tests/FallthroughAttributesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function all_three_blocked_when_all_defined_on_root(): void
219219
);
220220
}
221221

222-
// :apply
222+
// :apply
223223
//
224224
// :apply="$attributes" inside the component template opts out of auto-fallthrough
225225
// and spreads the full $attributes ImmutableArray onto the targeted element.

0 commit comments

Comments
 (0)