@@ -165,6 +165,50 @@ public static function generate(string $namespace, array $clients, SchemaRegistr
165165 yield new Node \Stmt \Case_ (
166166 new Node \Expr \ClassConstFetch (new Node \Name ($ operationCall ['className ' ]), 'OPERATION_MATCH ' ),
167167 [
168+ new Node \Stmt \Expression (new Node \Expr \Assign (
169+ new Node \Expr \Variable ('requestBodyData ' ),
170+ new Node \Expr \Array_ (),
171+ )),
172+ new Node \Stmt \Foreach_ (new Node \Expr \FuncCall (
173+ new Node \Name ('\array_keys ' ),
174+ [
175+ new Arg (new Node \Expr \Variable (new Node \Name ('params ' ))),
176+ ],
177+ ), new Node \Expr \Variable (new Node \Name ('param ' )), [
178+ 'stmts ' => [
179+ new Node \Stmt \If_ (
180+ new Node \Expr \BinaryOp \NotEqual (
181+ new Node \Expr \FuncCall (
182+ new Node \Name ('\in_array ' ),
183+ [
184+ new Arg (new Node \Expr \Variable (new Node \Name ('param ' ))),
185+ new Arg (new Node \Expr \Array_ (
186+ iterator_to_array ((function (array $ params ): iterable {
187+ foreach ($ params as $ param ) {
188+ yield new Node \Expr \ArrayItem (new Node \Scalar \String_ ($ param ));
189+ }
190+ })($ operationCall ['params ' ])),
191+ )),
192+ ],
193+ ),
194+ new Node \Expr \ConstFetch (new Node \Name ('false ' ))
195+ ),
196+ [
197+ 'stmts ' => [
198+ new Node \Stmt \Expression (
199+ new Node \Expr \FuncCall (
200+ new Node \Name ('\array_push ' ),
201+ [
202+ new Arg (new Node \Expr \Variable (new Node \Name ('requestBodyData ' ))),
203+ new Arg (new Node \Expr \Variable (new Node \Name ('param ' ))),
204+ ],
205+ ),
206+ ),
207+ ],
208+ ]
209+ ),
210+ ],
211+ ]),
168212 new Node \Stmt \Expression (new Node \Expr \Assign (
169213 new Node \Expr \Variable ('operation ' ),
170214 new Node \Expr \MethodCall (
@@ -181,7 +225,9 @@ public static function generate(string $namespace, array $clients, SchemaRegistr
181225 })($ operationCall ['params ' ])),
182226 )
183227 )),
184- new Node \Stmt \Expression (new Node \Expr \Assign (new Node \Expr \Variable ('request ' ), new Node \Expr \MethodCall (new Node \Expr \Variable ('operation ' ), 'createRequest ' , []))),
228+ new Node \Stmt \Expression (new Node \Expr \Assign (new Node \Expr \Variable ('request ' ), new Node \Expr \MethodCall (new Node \Expr \Variable ('operation ' ), 'createRequest ' , [
229+ new Arg (new Node \Expr \Variable (new Node \Name ('requestBodyData ' )))
230+ ]))),
185231 new Node \Stmt \Return_ (new Node \Expr \MethodCall (
186232 new Node \Expr \MethodCall (
187233 new Node \Expr \PropertyFetch (
0 commit comments