File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed
Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments