2121use function Tempest \invoke ;
2222use function Tempest \Support \arr ;
2323
24+ // @mago-expect lint:cyclomatic-complexity
2425final class InertiaResponse implements Response
2526{
2627 use IsResponse;
@@ -116,6 +117,7 @@ private static function resolvePartialProps(Request $request, string $component,
116117 string: $ headers ->get (Header::PARTIAL_EXCEPT ) ?? '' ,
117118 ));
118119
120+ /** @var mixed[] */
119121 $ filtered = $ only ? array_intersect_key ($ props , array_flip ($ only )) : $ props ;
120122
121123 return array_filter ($ filtered , static fn ($ key ) => !in_array ($ key , $ except , strict: true ), ARRAY_FILTER_USE_KEY );
@@ -157,8 +159,8 @@ private static function resolvePropKeysThatShouldMerge(array $props, Request $re
157159 /**
158160 * Evaluates props recursively.
159161 * @pure
162+ * @mago-expect lint:no-boolean-flag-parameter
160163 */
161- // @mago-expect lint:no-boolean-flag-parameter
162164 private static function evaluateProps (array $ props , Request $ request , bool $ unpackDotProps = true ): array
163165 {
164166 return arr ($ props )->map (function ($ value , string |int $ key ) use ($ request ): array {
@@ -170,13 +172,17 @@ private static function evaluateProps(array $props, Request $request, bool $unpa
170172 : $ evaluated ;
171173
172174 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- }, []);
175+ })->reduce (
176+ function (array $ acc , array $ item ) use ($ unpackDotProps ): array {
177+ /** @var string|int $key */
178+ [$ key , $ value ] = $ item ;
179+ if ($ unpackDotProps && is_string ($ key ) && str_contains ($ key , '. ' )) {
180+ return arr ($ acc )->set ($ key , $ value )->toArray ();
181+ }
182+ $ acc [$ key ] = $ value ;
183+ return $ acc ;
184+ },
185+ [],
186+ );
181187 }
182188}
0 commit comments