Skip to content

Commit

Permalink
Forward factories implemented by PSR-18 clients if any
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Apr 22, 2024
1 parent 0700efd commit f1bb03a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Psr18Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit f1bb03a

Please sign in to comment.