Skip to content

Commit 2a45b9c

Browse files
committed
wip
1 parent a149fb4 commit 2a45b9c

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

packages/view/src/ViewConfig.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,17 @@ public function addViewComponent(ViewComponent $pending): void
3030
{
3131
$existing = $this->viewComponents[$pending->name] ?? null;
3232

33-
if ($existing) {
34-
if ($pending->isVendorComponent) {
35-
// Vendor components don't overwrite existing components
36-
return;
37-
}
38-
39-
if ($existing->isProjectComponent && $pending->isProjectComponent) {
40-
// If both pending and existing are project components, we'll throw an exception
41-
throw new ViewComponentWasAlreadyRegistered(
42-
pending: $pending,
43-
existing: $existing,
44-
);
45-
}
33+
if ($existing && $pending->isVendorComponent) {
34+
// Vendor components don't overwrite existing components
35+
return;
36+
}
37+
38+
if ($existing?->isProjectComponent && $pending->isProjectComponent) {
39+
// If both pending and existing are project components, we'll throw an exception
40+
throw new ViewComponentWasAlreadyRegistered(
41+
pending: $pending,
42+
existing: $existing,
43+
);
4644
}
4745

4846
$this->viewComponents[$pending->name] = $pending;

0 commit comments

Comments
 (0)