Skip to content

Commit f1bb03a

Browse files
Forward factories implemented by PSR-18 clients if any
1 parent 0700efd commit f1bb03a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Psr18Client.php

+7
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ public function __construct(
3333
?UploadedFileFactoryInterface $uploadedFileFactory = null,
3434
?UriFactoryInterface $uriFactory = null
3535
) {
36+
$requestFactory ?? $requestFactory = $client instanceof RequestFactoryInterface ? $client : null;
37+
$responseFactory ?? $responseFactory = $client instanceof ResponseFactoryInterface ? $client : null;
38+
$serverRequestFactory ?? $serverRequestFactory = $client instanceof ServerRequestFactoryInterface ? $client : null;
39+
$streamFactory ?? $streamFactory = $client instanceof StreamFactoryInterface ? $client : null;
40+
$uploadedFileFactory ?? $uploadedFileFactory = $client instanceof UploadedFileFactoryInterface ? $client : null;
41+
$uriFactory ?? $uriFactory = $client instanceof UriFactoryInterface ? $client : null;
42+
3643
parent::__construct($requestFactory, $responseFactory, $serverRequestFactory, $streamFactory, $uploadedFileFactory, $uriFactory);
3744

3845
$this->client = $client ?? Psr18ClientDiscovery::find();

0 commit comments

Comments
 (0)