@@ -25,7 +25,7 @@ final class InertiaResponse implements Response
2525{
2626 use IsResponse;
2727
28- // @mago-expect maintainability/ excessive-parameter-list
28+ // @mago-expect lint: excessive-parameter-list
2929 public function __construct (
3030 readonly Request $ request ,
3131 readonly string $ component ,
@@ -158,26 +158,25 @@ private static function resolvePropKeysThatShouldMerge(array $props, Request $re
158158 * Evaluates props recursively.
159159 * @pure
160160 */
161- private static function evaluateProps (array $ props , Request $ request , bool $ unpackDotProps = true ): array // @mago-expect best-practices/no-boolean-flag-parameter
161+ // @mago-expect lint:no-boolean-flag-parameter
162+ private static function evaluateProps (array $ props , Request $ request , bool $ unpackDotProps = true ): array
162163 {
163- return arr ($ props )
164- ->map (function ($ value , string |int $ key ) use ($ request ): array {
165- $ evaluated = ($ value instanceof Closure) ? invoke ($ value ) : $ value ;
166- $ evaluated = ($ evaluated instanceof CallableProp) ? $ evaluated () : $ evaluated ;
167- $ evaluated = ($ evaluated instanceof ArrayInterface) ? $ evaluated ->toArray () : $ evaluated ;
168- $ evaluated = is_array ($ evaluated )
169- ? self ::evaluateProps ($ evaluated , $ request , unpackDotProps: false )
170- : $ evaluated ;
171-
172- return [$ key , $ evaluated ];
173- })
174- ->reduce (function (array $ acc , array $ item ) use ($ unpackDotProps ): array {
175- [$ key , $ value ] = $ item ;
176- if ($ unpackDotProps && is_string ($ key ) && str_contains ($ key , needle: '. ' )) {
177- return arr ($ acc )->set ($ key , $ value )->toArray ();
178- }
179- $ acc [$ key ] = $ value ;
180- return $ acc ;
181- }, []);
164+ return arr ($ props )->map (function ($ value , string |int $ key ) use ($ request ): array {
165+ $ evaluated = $ value instanceof Closure ? invoke ($ value ) : $ value ;
166+ $ evaluated = $ evaluated instanceof CallableProp ? $ evaluated () : $ evaluated ;
167+ $ evaluated = $ evaluated instanceof ArrayInterface ? $ evaluated ->toArray () : $ evaluated ;
168+ $ evaluated = is_array ($ evaluated )
169+ ? self ::evaluateProps ($ evaluated , $ request , unpackDotProps: false )
170+ : $ evaluated ;
171+
172+ return [$ key , $ evaluated ];
173+ })->reduce (function (array $ acc , array $ item ) use ($ unpackDotProps ): array {
174+ [$ key , $ value ] = $ item ;
175+ if ($ unpackDotProps && is_string ($ key ) && str_contains ($ key , needle: '. ' )) {
176+ return arr ($ acc )->set ($ key , $ value )->toArray ();
177+ }
178+ $ acc [$ key ] = $ value ;
179+ return $ acc ;
180+ }, []);
182181 }
183182}
0 commit comments