Skip to content

Commit 41a221e

Browse files
authored
Merge pull request #159 from Nyholm/1.x-typehints
[1.x] Added type hints for ClientInterface
2 parents 9c21b60 + a969891 commit 41a221e

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

src/HttpClientPool.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Http\Client\Common\Exception\HttpClientNotFoundException;
66
use Http\Client\HttpAsyncClient;
77
use Http\Client\HttpClient;
8+
use Psr\Http\Client\ClientInterface;
89
use Psr\Http\Message\RequestInterface;
910

1011
/**
@@ -21,7 +22,7 @@ abstract class HttpClientPool implements HttpAsyncClient, HttpClient
2122
/**
2223
* Add a client to the pool.
2324
*
24-
* @param HttpClient|HttpAsyncClient|HttpClientPoolItem $client
25+
* @param HttpClient|HttpAsyncClient|HttpClientPoolItem|ClientInterface $client
2526
*/
2627
public function addHttpClient($client)
2728
{

src/HttpClientPoolItem.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Http\Client\HttpAsyncClient;
66
use Http\Client\HttpClient;
7+
use Psr\Http\Client\ClientInterface;
78
use Psr\Http\Message\RequestInterface;
89
use Http\Client\Exception;
910

@@ -38,7 +39,7 @@ class HttpClientPoolItem implements HttpClient, HttpAsyncClient
3839
private $client;
3940

4041
/**
41-
* @param HttpClient|HttpAsyncClient $client
42+
* @param HttpClient|HttpAsyncClient|ClientInterface $client
4243
* @param null|int $reenableAfter Number of seconds after this client is reenable
4344
*/
4445
public function __construct($client, $reenableAfter = null)

src/HttpClientRouter.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Http\Client\HttpAsyncClient;
77
use Http\Client\HttpClient;
88
use Http\Message\RequestMatcher;
9+
use Psr\Http\Client\ClientInterface;
910
use Psr\Http\Message\RequestInterface;
1011

1112
/**
@@ -43,7 +44,7 @@ public function sendAsyncRequest(RequestInterface $request)
4344
/**
4445
* Add a client to the router.
4546
*
46-
* @param HttpClient|HttpAsyncClient $client
47+
* @param HttpClient|HttpAsyncClient|ClientInterface $client
4748
* @param RequestMatcher $requestMatcher
4849
*/
4950
public function addClient($client, RequestMatcher $requestMatcher)
@@ -59,7 +60,7 @@ public function addClient($client, RequestMatcher $requestMatcher)
5960
*
6061
* @param RequestInterface $request
6162
*
62-
* @return HttpClient|HttpAsyncClient
63+
* @return HttpClient|HttpAsyncClient|ClientInterface
6364
*/
6465
protected function chooseHttpClient(RequestInterface $request)
6566
{

src/PluginClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class PluginClient implements HttpClient, HttpAsyncClient
4141
private $options;
4242

4343
/**
44-
* @param HttpClient|HttpAsyncClient $client
44+
* @param HttpClient|HttpAsyncClient|ClientInterface $client
4545
* @param Plugin[] $plugins
4646
* @param array $options {
4747
*

0 commit comments

Comments
 (0)