Skip to content

[1.x] Added type hints for ClientInterface #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/HttpClientPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion src/HttpClientPoolItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/HttpClientRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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)
Expand All @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/PluginClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
*
Expand Down