Skip to content

Commit d31b7b0

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

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 ??= $client instanceof RequestFactoryInterface ? $client : null;
37+
$responseFactory ??= $client instanceof ResponseFactoryInterface ? $client : null;
38+
$serverRequestFactory ??= $client instanceof ServerRequestFactoryInterface ? $client : null;
39+
$streamFactory ??= $client instanceof StreamFactoryInterface ? $client : null;
40+
$uploadedFileFactory ??= $client instanceof UploadedFileFactoryInterface ? $client : null;
41+
$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)