2121use Symfony \Component \OptionsResolver \Options ;
2222use Symfony \Component \OptionsResolver \OptionsResolver ;
2323
24+ /**
25+ * @phpstan-type RequestOptions array{
26+ * 'client': string,
27+ * 'method': string,
28+ * 'soap_call_options': array<mixed>|null,
29+ * 'soap_call_headers': array<\SoapHeader>|null,
30+ * }
31+ */
2432class RequestTask extends AbstractConfigurableTask
2533{
2634 public function __construct (protected LoggerInterface $ logger , protected ClientRegistry $ registry )
@@ -29,15 +37,20 @@ public function __construct(protected LoggerInterface $logger, protected ClientR
2937
3038 public function execute (ProcessState $ state ): void
3139 {
40+ /** @var RequestOptions $options */
3241 $ options = $ this ->getOptions ($ state );
3342
3443 $ client = $ this ->registry ->getClient ($ options ['client ' ]);
3544
3645 /** @var array<mixed> $input */
3746 $ input = $ state ->getInput () ?: [];
3847
39- $ client ->setSoapOptions ($ this ->getOption ($ state , 'soap_call_options ' ));
40- $ client ->setSoapHeaders ($ this ->getOption ($ state , 'soap_call_headers ' ));
48+ /** @var array<mixed>|null $soapCallOptions */
49+ $ soapCallOptions = $ this ->getOption ($ state , 'soap_call_options ' );
50+ $ client ->setSoapOptions ($ soapCallOptions );
51+ /** @var array<\SoapHeader>|null $soapCallHeaders */
52+ $ soapCallHeaders = $ this ->getOption ($ state , 'soap_call_headers ' );
53+ $ client ->setSoapHeaders ($ soapCallHeaders );
4154
4255 $ result = $ client ->call ($ options ['method ' ], $ input );
4356
@@ -93,7 +106,9 @@ protected function configureOptions(OptionsResolver $resolver): void
93106 $ this ->configureSoapCallHeaderOption ($ headerResolver );
94107
95108 $ resolvedHeaders = [];
109+ /** @var array<string, array<mixed>> $headers */
96110 foreach ($ headers as $ name => $ header ) {
111+ /** @var array{'namespace': string, 'data': array<mixed>} $resolvedHeader */
97112 $ resolvedHeader = $ headerResolver ->resolve ($ header );
98113 $ resolvedHeaders [] = new \SoapHeader ($ resolvedHeader ['namespace ' ], $ name , $ resolvedHeader ['data ' ]);
99114 }
0 commit comments