2222 */
2323class Client implements ClientInterface
2424{
25- /** @var array */
26- private $ soapOptions ;
25+ /** @var array<mixed>|null */
26+ private ? array $ soapOptions = null ;
2727
2828 /** @var \SoapHeader[]|null */
29- private $ soapHeaders ;
29+ private ? array $ soapHeaders = null ;
3030
31- /** @var \SoapClient */
32- private $ soapClient ;
31+ private ?\SoapClient $ soapClient = null ;
3332
34- /** @var string */
35- private $ lastRequest ;
33+ private ?string $ lastRequest = null ;
3634
37- /** @var string */
38- private $ lastRequestHeaders ;
35+ private ?string $ lastRequestHeaders = null ;
3936
40- /** @var string */
41- private $ lastResponse ;
37+ private ?string $ lastResponse = null ;
4238
43- /** @var string */
44- private $ lastResponseHeaders ;
39+ private ?string $ lastResponseHeaders = null ;
4540
4641 /**
4742 * Client constructor.
@@ -50,6 +45,7 @@ public function __construct(
5045 private readonly LoggerInterface $ logger ,
5146 private readonly string $ code ,
5247 private ?string $ wsdl ,
48+ /** @var array<mixed> */
5349 private array $ options = [],
5450 ) {
5551 }
@@ -167,9 +163,6 @@ public function setLastResponseHeaders(?string $lastResponseHeaders): void
167163 $ this ->lastResponseHeaders = $ lastResponseHeaders ;
168164 }
169165
170- /**
171- * @return bool|mixed
172- */
173166 public function call (string $ method , array $ input = []): mixed
174167 {
175168 $ this ->initializeSoapClient ();
@@ -187,6 +180,8 @@ public function call(string $method, array $input = []): mixed
187180 }
188181
189182 /**
183+ * @param array<mixed> $input
184+ *
190185 * @return bool|mixed
191186 */
192187 protected function doSoapCall (string $ method , array $ input = []): mixed
@@ -196,7 +191,7 @@ protected function doSoapCall(string $method, array $input = []): mixed
196191 }
197192 try {
198193 $ result = $ this ->getSoapClient ()->__soapCall ($ method , $ input , $ this ->getSoapOptions (), $ this ->getSoapHeaders ());
199- } /* @noinspection PhpRedundantCatchClauseInspection */ catch (\SoapFault $ e ) {
194+ } catch (\SoapFault $ e ) {
200195 $ this ->getLastRequestTrace ();
201196 $ this ->getLogger ()->alert (
202197 \sprintf ("Soap call '%s' on '%s' failed : %s " , $ method , $ this ->getWsdl (), $ e ->getMessage ()),
@@ -231,14 +226,23 @@ protected function initializeSoapClient(): void
231226
232227 protected function getLastRequestTrace (): void
233228 {
234- if ($ this ->getSoapClient () instanceof \SoapClient) {
235- $ this ->setLastRequest ($ this ->getSoapClient ()->__getLastRequest ());
236- $ this ->setLastRequestHeaders ($ this ->getSoapClient ()->__getLastRequestHeaders ());
237- $ this ->setLastResponse ($ this ->getSoapClient ()->__getLastResponse ());
238- $ this ->setLastResponseHeaders ($ this ->getSoapClient ()->__getLastResponseHeaders ());
229+ $ soapClient = $ this ->getSoapClient ();
230+ if ($ soapClient instanceof \SoapClient) {
231+ $ this ->setLastRequest ($ soapClient ->__getLastRequest ());
232+ $ this ->setLastRequestHeaders ($ soapClient ->__getLastRequestHeaders ());
233+ $ this ->setLastResponse ($ soapClient ->__getLastResponse ());
234+ $ this ->setLastResponseHeaders ($ soapClient ->__getLastResponseHeaders ());
239235 }
240236 }
241237
238+ /**
239+ * @return array{
240+ * 'LastRequest': ?string,
241+ * 'LastRequestHeaders': ?string,
242+ * 'LastResponse': ?string,
243+ * 'LastResponseHeaders': ?string
244+ * }
245+ */
242246 protected function getLastRequestTraceArray (): array
243247 {
244248 return [
0 commit comments