File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -15,14 +15,14 @@ final class FlowDefinitionRegistry
1515
1616 public function __construct (?string $ path = null )
1717 {
18- $ this ->path = base_path (config ('flowpipe.definitions_path ' , 'flow_definitions ' ));
18+ $ this ->path = $ path ?? base_path (config ('flowpipe.definitions_path ' , 'flow_definitions ' ));
1919 }
2020
2121 public function list (): Collection
2222 {
2323 return collect (File::files ($ this ->path ))
24- ->filter (fn ($ f ) => str_ends_with ($ f ->getFilename (), '.yaml ' ))
25- ->map (fn ($ f ) => $ f ->getFilenameWithoutExtension ());
24+ ->filter (fn ($ f ): bool => str_ends_with ($ f ->getFilename (), '.yaml ' ))
25+ ->map (fn ($ f ): string => $ f ->getFilenameWithoutExtension ());
2626 }
2727
2828 public function get (string $ name ): array
Original file line number Diff line number Diff line change @@ -14,14 +14,14 @@ final class StepResolver
1414 /**
1515 * Resolve a given step into a FlowStep instance or Closure.
1616 */
17- public static function resolve (FlowStep | Closure | string $ step ): FlowStep |Closure
17+ public static function resolve (mixed $ step ): FlowStep |Closure
1818 {
19- // Already a usable instance
20- if ($ step instanceof Closure || $ step instanceof FlowStep ) {
19+ // Step is already an instance or closure
20+ if ($ step instanceof FlowStep || $ step instanceof Closure ) {
2121 return $ step ;
2222 }
2323
24- // Try resolving by class name or configured namespace
24+ // Step is a string → resolve class
2525 if (is_string ($ step )) {
2626 $ class = class_exists ($ step )
2727 ? $ step
@@ -40,6 +40,7 @@ public static function resolve(FlowStep|Closure|string $step): FlowStep|Closure
4040 return $ instance ;
4141 }
4242
43+ // Step is invalid
4344 throw new InvalidArgumentException ('Invalid step type: ' .gettype ($ step ));
4445 }
4546}
You can’t perform that action at this time.
0 commit comments