@@ -29,8 +29,10 @@ abstract class Metadata
2929 * @param string|\Stringable|null $securityPostDenormalize https://api-platform.com/docs/core/security/#executing-access-control-rules-after-denormalization
3030 * @param mixed|null $mercure
3131 * @param mixed|null $messenger
32- * @param mixed|null $input
33- * @param mixed|null $output
32+ * @param mixed|null $input @deprecated use inputClass instead
33+ * @param mixed|null $inputClass
34+ * @param mixed|null $output @deprecated use outputClass instead
35+ * @param mixed|null $outputClass
3436 * @param mixed|null $provider
3537 * @param mixed|null $processor
3638 * @param Parameters|array<string, Parameter> $parameters
@@ -50,7 +52,9 @@ public function __construct(
5052 protected $ mercure = null ,
5153 protected $ messenger = null ,
5254 protected $ input = null ,
55+ protected ?string $ inputClass = null ,
5356 protected $ output = null ,
57+ protected ?string $ outputClass = null ,
5458 protected ?array $ order = null ,
5559 protected ?bool $ fetchPartial = null ,
5660 protected ?bool $ forceEager = null ,
@@ -272,26 +276,108 @@ public function withMessenger(mixed $messenger): static
272276 return $ self ;
273277 }
274278
279+ /**
280+ * @deprecated use getInputClass() instead
281+ */
275282 public function getInput (): mixed
276283 {
284+ trigger_deprecation ('api-platform/metadata ' , '4.3 ' , 'The method "getInput()" is deprecated, use "getInputClass()" instead. ' );
285+
277286 return $ this ->input ;
278287 }
279288
289+ /**
290+ * @deprecated use withInputClass() instead
291+ */
280292 public function withInput (mixed $ input ): static
281293 {
294+ trigger_deprecation ('api-platform/metadata ' , '4.3 ' , 'The method "withInput()" is deprecated, use "withInputClass()" instead. ' );
295+
282296 $ self = clone $ this ;
283297 $ self ->input = $ input ;
284298
285299 return $ self ;
286300 }
287301
302+ public function getInputClass (): ?string
303+ {
304+ if (null !== $ this ->inputClass ) {
305+ return $ this ->inputClass ;
306+ }
307+
308+ if (false === $ this ->input ) {
309+ return null ;
310+ }
311+
312+ if (\is_array ($ this ->input ) && \is_string ($ this ->input ['class ' ] ?? null )) {
313+ return $ this ->input ['class ' ];
314+ }
315+
316+ if (null === $ this ->input ) {
317+ return $ this ->getClass ();
318+ }
319+
320+ return null ;
321+ }
322+
323+ /**
324+ * @param class-string|null $inputClass
325+ * @return $this
326+ */
327+ public function withInputClass (?string $ inputClass ): static
328+ {
329+ $ self = clone $ this ;
330+ $ self ->inputClass = $ inputClass ;
331+
332+ return $ self ;
333+ }
334+
335+ public function getOutputClass (): ?string
336+ {
337+ if (null !== $ this ->outputClass ) {
338+ return $ this ->outputClass ;
339+ }
340+
341+ if (false === $ this ->output ) {
342+ return null ;
343+ }
344+
345+ if (\is_array ($ this ->output ) && \is_string ($ this ->output ['class ' ] ?? null )) {
346+ return $ this ->output ['class ' ];
347+ }
348+
349+ if (null === $ this ->output ) {
350+ return $ this ->getClass ();
351+ }
352+
353+ return null ;
354+ }
355+
356+ public function withOutputClass (?string $ outputClass ): static
357+ {
358+ $ self = clone $ this ;
359+ $ self ->outputClass = $ outputClass ;
360+
361+ return $ self ;
362+ }
363+
364+ /**
365+ * @deprecated use getOutputClass() instead
366+ */
288367 public function getOutput (): mixed
289368 {
369+ trigger_deprecation ('api-platform/metadata ' , '4.3 ' , 'The method "getOutput()" is deprecated, use "getOutputClass()" instead. ' );
370+
290371 return $ this ->output ;
291372 }
292373
374+ /**
375+ * @deprecated use withOutputClass() instead
376+ */
293377 public function withOutput (mixed $ output ): static
294378 {
379+ trigger_deprecation ('api-platform/metadata ' , '4.3 ' , 'The method "withOutput()" is deprecated, use "withOutputClass()" instead. ' );
380+
295381 $ self = clone $ this ;
296382 $ self ->output = $ output ;
297383
0 commit comments