fix(#642) HttpApi: Expect client to be of type ClientInterface|PluginClient (#660)

* HttpApi: Expect client to be of type ClientInterface|PluginClient

* Format with pretty

* pretty-fix run on the whole repo

* User is_a instead of instance_of for php-stan

* Use the namespaced classname in instanceof checks

* Fix param documentation for MessageBuilder::parseAddress

* Use ClassName::class approach in is_a
This commit is contained in:
Tony Thomas 2020-10-16 17:46:06 +02:00 committed by GitHub
parent 6e372e1e33
commit 1fd018d61c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Mailgun\Api;
use Http\Client\Common\PluginClient;
use Mailgun\Exception\HttpClientException;
use Mailgun\Exception\HttpServerException;
use Mailgun\Exception\UnknownErrorException;
@ -29,7 +30,7 @@ abstract class HttpApi
/**
* The HTTP client.
*
* @var ClientInterface
* @var ClientInterface|PluginClient
*/
protected $httpClient;
@ -43,8 +44,13 @@ abstract class HttpApi
*/
protected $requestBuilder;
public function __construct(ClientInterface $httpClient, RequestBuilder $requestBuilder, Hydrator $hydrator)
public function __construct($httpClient, RequestBuilder $requestBuilder, Hydrator $hydrator)
{
if (!is_a($httpClient, ClientInterface::class) &&
!is_a($httpClient, PluginClient::class)) {
throw new \RuntimeException('httpClient must be an instance of
Psr\Http\Client\ClientInterface or Http\Client\Common\PluginClient');
}
$this->httpClient = $httpClient;
$this->requestBuilder = $requestBuilder;
if (!$hydrator instanceof NoopHydrator) {

View File

@ -84,6 +84,8 @@ class MessageBuilder
}
/**
* @param array $variables {
*
* @var string
* @var string
* @var string