diff --git a/src/Psr18Client.php b/src/Psr18Client.php index 26b6aeb..48df783 100644 --- a/src/Psr18Client.php +++ b/src/Psr18Client.php @@ -33,6 +33,13 @@ public function __construct( ?UploadedFileFactoryInterface $uploadedFileFactory = null, ?UriFactoryInterface $uriFactory = null ) { + $requestFactory ?? $requestFactory = $client instanceof RequestFactoryInterface ? $client : null; + $responseFactory ?? $responseFactory = $client instanceof ResponseFactoryInterface ? $client : null; + $serverRequestFactory ?? $serverRequestFactory = $client instanceof ServerRequestFactoryInterface ? $client : null; + $streamFactory ?? $streamFactory = $client instanceof StreamFactoryInterface ? $client : null; + $uploadedFileFactory ?? $uploadedFileFactory = $client instanceof UploadedFileFactoryInterface ? $client : null; + $uriFactory ?? $uriFactory = $client instanceof UriFactoryInterface ? $client : null; + parent::__construct($requestFactory, $responseFactory, $serverRequestFactory, $streamFactory, $uploadedFileFactory, $uriFactory); $this->client = $client ?? Psr18ClientDiscovery::find();