From a9698915de575e27ccc447c7b5557586d17590e9 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Thu, 10 Jan 2019 17:47:04 +0100 Subject: [PATCH] Added type hints for ClientInterface --- src/HttpClientPool.php | 3 ++- src/HttpClientPoolItem.php | 3 ++- src/HttpClientRouter.php | 5 +++-- src/PluginClient.php | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/HttpClientPool.php b/src/HttpClientPool.php index 7ac292c..c51d044 100644 --- a/src/HttpClientPool.php +++ b/src/HttpClientPool.php @@ -5,6 +5,7 @@ use Http\Client\Common\Exception\HttpClientNotFoundException; use Http\Client\HttpAsyncClient; use Http\Client\HttpClient; +use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestInterface; /** @@ -21,7 +22,7 @@ abstract class HttpClientPool implements HttpAsyncClient, HttpClient /** * Add a client to the pool. * - * @param HttpClient|HttpAsyncClient|HttpClientPoolItem $client + * @param HttpClient|HttpAsyncClient|HttpClientPoolItem|ClientInterface $client */ public function addHttpClient($client) { diff --git a/src/HttpClientPoolItem.php b/src/HttpClientPoolItem.php index 09cd6dd..5c79137 100644 --- a/src/HttpClientPoolItem.php +++ b/src/HttpClientPoolItem.php @@ -4,6 +4,7 @@ use Http\Client\HttpAsyncClient; use Http\Client\HttpClient; +use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestInterface; use Http\Client\Exception; @@ -38,7 +39,7 @@ class HttpClientPoolItem implements HttpClient, HttpAsyncClient private $client; /** - * @param HttpClient|HttpAsyncClient $client + * @param HttpClient|HttpAsyncClient|ClientInterface $client * @param null|int $reenableAfter Number of seconds after this client is reenable */ public function __construct($client, $reenableAfter = null) diff --git a/src/HttpClientRouter.php b/src/HttpClientRouter.php index 9f72133..8f897d2 100644 --- a/src/HttpClientRouter.php +++ b/src/HttpClientRouter.php @@ -6,6 +6,7 @@ use Http\Client\HttpAsyncClient; use Http\Client\HttpClient; use Http\Message\RequestMatcher; +use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestInterface; /** @@ -43,7 +44,7 @@ public function sendAsyncRequest(RequestInterface $request) /** * Add a client to the router. * - * @param HttpClient|HttpAsyncClient $client + * @param HttpClient|HttpAsyncClient|ClientInterface $client * @param RequestMatcher $requestMatcher */ public function addClient($client, RequestMatcher $requestMatcher) @@ -59,7 +60,7 @@ public function addClient($client, RequestMatcher $requestMatcher) * * @param RequestInterface $request * - * @return HttpClient|HttpAsyncClient + * @return HttpClient|HttpAsyncClient|ClientInterface */ protected function chooseHttpClient(RequestInterface $request) { diff --git a/src/PluginClient.php b/src/PluginClient.php index 8cedcf6..c90ddcf 100644 --- a/src/PluginClient.php +++ b/src/PluginClient.php @@ -41,7 +41,7 @@ final class PluginClient implements HttpClient, HttpAsyncClient private $options; /** - * @param HttpClient|HttpAsyncClient $client + * @param HttpClient|HttpAsyncClient|ClientInterface $client * @param Plugin[] $plugins * @param array $options { *