Skip to content

Commit fb44941

Browse files
committed
wip
1 parent ccfa9e3 commit fb44941

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/view/src/ViewComponentDiscovery.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,30 @@ public function discoverPath(DiscoveryLocation $location, string $path): void
5353
matches: $matches,
5454
);
5555

56-
if ($fileName->startsWith('x-') && ! isset($matches['name'])) {
56+
$header = $matches['header'] ?? null;
57+
$view = $matches['view'] ?? null;
58+
$name = $matches['name'] ?? null;
59+
60+
if ($fileName->startsWith('x-') && $name === null) {
5761
$this->discoveryItems->add($location, [
5862
$fileName->toString(),
5963
new AnonymousViewComponent(
60-
contents: $matches['view'] ?? $contents->toString(),
64+
contents: $view ?? $contents->toString(),
6165
file: $path,
6266
),
6367
]);
6468

6569
return;
6670
}
6771

68-
if (! isset($matches['name'], $matches['header'])) {
72+
if ($name === null || $header === null) {
6973
return;
7074
}
7175

7276
$this->discoveryItems->add($location, [
73-
$matches['name'],
77+
$name,
7478
new AnonymousViewComponent(
75-
contents: $matches['header'] . $matches['view'],
79+
contents: $header . $view,
7680
file: $path,
7781
),
7882
]);

0 commit comments

Comments
 (0)