File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -44,14 +44,18 @@ private static function getConstructorArgument(
4444 }
4545
4646 if (!empty ($ propertyType ->subProperties )) {
47- $ content = match ($ propertyType ->type ) {
47+ $ content = ( match ($ propertyType ->type ) {
4848 InputParamType::Query => $ request ->query ,
4949 InputParamType::Json => $ cacheJsonContent ,
5050 InputParamType::Input => $ request ->input ,
51- };
51+ })[$ propertyType ->name ] ?? null ;
52+
53+ if (!is_array ($ content )) {
54+ return $ propertyType ->defaultValue ;
55+ }
5256
5357 $ subItemConstructorArgs = array_map (
54- fn (RequestProperty $ subProperty ) => self ::getSubObjectConstructorArguments ($ subProperty , $ content[ $ propertyType -> name ] ?? [] ),
58+ fn (RequestProperty $ subProperty ) => self ::getSubObjectConstructorArguments ($ subProperty , $ content ),
5559 $ propertyType ->subProperties ,
5660 );
5761
Original file line number Diff line number Diff line change 88use PhpApi \Enum \RouterExceptions ;
99use PhpApi \Interface \IRequestMiddleware ;
1010use PhpApi \Interface \IResponseMiddleware ;
11- use PhpApi \Model \Request \AbstractRequest ;
1211use PhpApi \Model \Request \RequestParser ;
1312use PhpApi \Model \Response \AbstractResponse ;
1413use PhpApi \Model \RouterOptions ;
You can’t perform that action at this time.
0 commit comments