File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
src/Tempest/Framework/Commands Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -60,20 +60,13 @@ private function makeData(ViewComponent $viewComponent): ImmutableArray
6060 private function resolveViewComponent (string $ viewComponent ): ?ViewComponent
6161 {
6262 if (is_file ($ viewComponent )) {
63- foreach ($ this ->viewConfig ->viewComponents as $ registeredViewComponent ) {
64- if ($ registeredViewComponent ->file !== $ viewComponent ) {
65- continue ;
66- }
67-
68- $ viewComponent = $ registeredViewComponent ;
69-
70- break ;
71- }
72- } else {
73- $ viewComponent = $ this ->viewConfig ->viewComponents [$ viewComponent ] ?? null ;
63+ return array_find (
64+ array: $ this ->viewConfig ->viewComponents ,
65+ callback: fn ($ registeredViewComponent ) => $ registeredViewComponent ->file === $ viewComponent ,
66+ );
7467 }
7568
76- return $ viewComponent ;
69+ return $ this -> viewConfig -> viewComponents [ $ viewComponent] ?? null ;
7770 }
7871
7972 private function resolveSlots (ViewComponent $ viewComponent ): ImmutableArray
You can’t perform that action at this time.
0 commit comments