Correct config file (#837)

Test

Test

Test

Test

Test

Test

Test

Ignore errors

Ignore errors

Ignore errors

Webhook is still using ClientInterface type declaration #783
This commit is contained in:
Oleksandr Mykhailenko 2022-08-27 18:39:53 +03:00 committed by GitHub
parent 30fe24de74
commit 62bd235af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 9 deletions

4
roave-bc-check.yaml Normal file
View File

@ -0,0 +1,4 @@
parameters:
ignoreErrors:
- '#Mailgun\\Api\\Webhook#'
- '#Mailgun\\Api\\Suppression#'

View File

@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Mailgun\Api; namespace Mailgun\Api;
use Http\Client\Common\PluginClient;
use Mailgun\Exception\HttpClientException; use Mailgun\Exception\HttpClientException;
use Mailgun\Exception\HttpServerException; use Mailgun\Exception\HttpServerException;
use Mailgun\Exception\UnknownErrorException; use Mailgun\Exception\UnknownErrorException;
@ -31,7 +30,7 @@ abstract class HttpApi
/** /**
* The HTTP client. * The HTTP client.
* *
* @var ClientInterface|PluginClient * @var ClientInterface
*/ */
protected $httpClient; protected $httpClient;
@ -45,13 +44,13 @@ abstract class HttpApi
*/ */
protected $requestBuilder; protected $requestBuilder;
/**
* @param ClientInterface $httpClient
* @param RequestBuilder $requestBuilder
* @param Hydrator $hydrator
*/
public function __construct($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->httpClient = $httpClient;
$this->requestBuilder = $requestBuilder; $this->requestBuilder = $requestBuilder;
if (!$hydrator instanceof NoopHydrator) { if (!$hydrator instanceof NoopHydrator) {

View File

@ -41,7 +41,12 @@ class Suppression
*/ */
private $hydrator; private $hydrator;
public function __construct(ClientInterface $httpClient, RequestBuilder $requestBuilder, Hydrator $hydrator) /**
* @param ClientInterface $httpClient
* @param RequestBuilder $requestBuilder
* @param Hydrator $hydrator
*/
public function __construct($httpClient, RequestBuilder $requestBuilder, Hydrator $hydrator)
{ {
$this->httpClient = $httpClient; $this->httpClient = $httpClient;
$this->requestBuilder = $requestBuilder; $this->requestBuilder = $requestBuilder;

View File

@ -34,7 +34,13 @@ class Webhook extends HttpApi
*/ */
private $apiKey; private $apiKey;
public function __construct(ClientInterface $httpClient, RequestBuilder $requestBuilder, Hydrator $hydrator, string $apiKey) /**
* @param ClientInterface $httpClient
* @param RequestBuilder $requestBuilder
* @param Hydrator $hydrator
* @param string $apiKey
*/
public function __construct($httpClient, RequestBuilder $requestBuilder, Hydrator $hydrator, string $apiKey)
{ {
parent::__construct($httpClient, $requestBuilder, $hydrator); parent::__construct($httpClient, $requestBuilder, $hydrator);
$this->apiKey = $apiKey; $this->apiKey = $apiKey;