build: fix style and phpstan

This commit is contained in:
Martin San Juan 2020-03-30 19:18:19 -03:00 committed by David Garcia
parent 5975310f0e
commit 3fc2f8e227
18 changed files with 22 additions and 36 deletions

View File

@ -21,6 +21,7 @@ return PhpCsFixer\Config::create()
'declare_strict_types' => true, 'declare_strict_types' => true,
'no_empty_phpdoc' => true, 'no_empty_phpdoc' => true,
'no_superfluous_phpdoc_tags' => true, 'no_superfluous_phpdoc_tags' => true,
'no_unneeded_final_method' => false, # prevent phpstan divergence
'header_comment' => [ 'header_comment' => [
'commentType' => 'comment', 'commentType' => 'comment',
'header' => $header, 'header' => $header,

View File

@ -35,7 +35,6 @@ class Domain extends HttpApi
/** /**
* Returns a list of domains on the account. * Returns a list of domains on the account.
* *
*
* @return IndexResponse * @return IndexResponse
*/ */
public function index(int $limit = 100, int $skip = 0) public function index(int $limit = 100, int $skip = 0)

View File

@ -11,12 +11,12 @@ declare(strict_types=1);
namespace Mailgun\Api; namespace Mailgun\Api;
use Mailgun\Exception\UnknownErrorException;
use Mailgun\Hydrator\Hydrator;
use Mailgun\Hydrator\NoopHydrator;
use Mailgun\Exception\HttpClientException; use Mailgun\Exception\HttpClientException;
use Mailgun\Exception\HttpServerException; use Mailgun\Exception\HttpServerException;
use Mailgun\Exception\UnknownErrorException;
use Mailgun\HttpClient\RequestBuilder; use Mailgun\HttpClient\RequestBuilder;
use Mailgun\Hydrator\Hydrator;
use Mailgun\Hydrator\NoopHydrator;
use Psr\Http\Client as Psr18; use Psr\Http\Client as Psr18;
use Psr\Http\Client\ClientInterface; use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;

View File

@ -27,7 +27,6 @@ class Ip extends HttpApi
/** /**
* Returns a list of IPs. * Returns a list of IPs.
* *
*
* @return IndexResponse|ResponseInterface * @return IndexResponse|ResponseInterface
*/ */
public function index(bool $dedicated = false) public function index(bool $dedicated = false)
@ -46,7 +45,6 @@ class Ip extends HttpApi
/** /**
* Returns a list of IPs assigned to a domain. * Returns a list of IPs assigned to a domain.
* *
*
* @return IndexResponse|ResponseInterface * @return IndexResponse|ResponseInterface
*/ */
public function domainIndex(string $domain) public function domainIndex(string $domain)
@ -61,7 +59,6 @@ class Ip extends HttpApi
/** /**
* Returns a single ip. * Returns a single ip.
* *
*
* @return ShowResponse|ResponseInterface * @return ShowResponse|ResponseInterface
*/ */
public function show(string $ip) public function show(string $ip)
@ -76,7 +73,6 @@ class Ip extends HttpApi
/** /**
* Assign a dedicated IP to the domain specified. * Assign a dedicated IP to the domain specified.
* *
*
* @return UpdateResponse|ResponseInterface * @return UpdateResponse|ResponseInterface
*/ */
public function assign(string $domain, string $ip) public function assign(string $domain, string $ip)
@ -95,8 +91,6 @@ class Ip extends HttpApi
/** /**
* Unassign an IP from the domain specified. * Unassign an IP from the domain specified.
*
* *
* @return UpdateResponse|ResponseInterface * @return UpdateResponse|ResponseInterface
*/ */

View File

@ -128,11 +128,7 @@ class Member extends HttpApi
// workaround for webmozart/asserts <= 1.2 // workaround for webmozart/asserts <= 1.2
if (count($members) > 1000) { if (count($members) > 1000) {
throw new InvalidArgumentException(sprintf( throw new InvalidArgumentException(sprintf('Expected an Array to contain at most %2$d elements. Got: %d', 1000, count($members)));
'Expected an Array to contain at most %2$d elements. Got: %d',
1000,
count($members)
));
} }
foreach ($members as $data) { foreach ($members as $data) {

View File

@ -71,7 +71,7 @@ class Message extends HttpApi
* *
* @return SendResponse|ResponseInterface * @return SendResponse|ResponseInterface
*/ */
public function sendMime(string $domain, array $recipients, string $message, array $params) public function sendMime(string $domain, array $recipients, string $message, array $params)
{ {
Assert::string($domain); Assert::string($domain);
Assert::notEmpty($domain); Assert::notEmpty($domain);

View File

@ -14,9 +14,9 @@ namespace Mailgun\Api;
use Mailgun\Api\Suppression\Bounce; use Mailgun\Api\Suppression\Bounce;
use Mailgun\Api\Suppression\Complaint; use Mailgun\Api\Suppression\Complaint;
use Mailgun\Api\Suppression\Unsubscribe; use Mailgun\Api\Suppression\Unsubscribe;
use Mailgun\HttpClient\RequestBuilder;
use Mailgun\Hydrator\Hydrator; use Mailgun\Hydrator\Hydrator;
use Psr\Http\Client\ClientInterface; use Psr\Http\Client\ClientInterface;
use Mailgun\HttpClient\RequestBuilder;
/** /**
* @see https://documentation.mailgun.com/api-suppressions.html * @see https://documentation.mailgun.com/api-suppressions.html

View File

@ -67,7 +67,6 @@ class Tag extends HttpApi
/** /**
* Update a tag. * Update a tag.
* *
*
* @return UpdateResponse|ResponseInterface * @return UpdateResponse|ResponseInterface
*/ */
public function update(string $domain, string $tag, string $description) public function update(string $domain, string $tag, string $description)
@ -87,7 +86,6 @@ class Tag extends HttpApi
/** /**
* Returns statistics for a single tag. * Returns statistics for a single tag.
* *
*
* @return StatisticsResponse|ResponseInterface * @return StatisticsResponse|ResponseInterface
*/ */
public function stats(string $domain, string $tag, array $params) public function stats(string $domain, string $tag, array $params)
@ -103,7 +101,6 @@ class Tag extends HttpApi
/** /**
* Removes a tag from the account. * Removes a tag from the account.
* *
*
* @return DeleteResponse|ResponseInterface * @return DeleteResponse|ResponseInterface
*/ */
public function delete(string $domain, string $tag) public function delete(string $domain, string $tag)

View File

@ -12,15 +12,15 @@ declare(strict_types=1);
namespace Mailgun\Api; namespace Mailgun\Api;
use Mailgun\Assert; use Mailgun\Assert;
use Mailgun\HttpClient\RequestBuilder;
use Mailgun\Hydrator\Hydrator; use Mailgun\Hydrator\Hydrator;
use Mailgun\Model\Webhook\CreateResponse; use Mailgun\Model\Webhook\CreateResponse;
use Mailgun\Model\Webhook\DeleteResponse; use Mailgun\Model\Webhook\DeleteResponse;
use Mailgun\Model\Webhook\IndexResponse; use Mailgun\Model\Webhook\IndexResponse;
use Mailgun\Model\Webhook\ShowResponse; use Mailgun\Model\Webhook\ShowResponse;
use Mailgun\Model\Webhook\UpdateResponse; use Mailgun\Model\Webhook\UpdateResponse;
use Mailgun\HttpClient\RequestBuilder;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Client\ClientInterface; use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\ResponseInterface;
/** /**
* @see https://documentation.mailgun.com/en/latest/api-webhooks.html * @see https://documentation.mailgun.com/en/latest/api-webhooks.html

View File

@ -15,10 +15,10 @@ use Http\Client\Common\PluginClient;
use Mailgun\HttpClient\HttpClientConfigurator; use Mailgun\HttpClient\HttpClientConfigurator;
use Mailgun\HttpClient\Plugin\History; use Mailgun\HttpClient\Plugin\History;
use Mailgun\HttpClient\RequestBuilder; use Mailgun\HttpClient\RequestBuilder;
use Mailgun\Hydrator\ModelHydrator;
use Mailgun\Hydrator\Hydrator; use Mailgun\Hydrator\Hydrator;
use Psr\Http\Message\ResponseInterface; use Mailgun\Hydrator\ModelHydrator;
use Psr\Http\Client\ClientInterface; use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\ResponseInterface;
/** /**
* This class is the base class for the Mailgun SDK. * This class is the base class for the Mailgun SDK.

View File

@ -54,7 +54,7 @@ abstract class AbstractDomainResponse implements ApiResponse
return $model; return $model;
} }
private function __construct() final private function __construct()
{ {
} }

View File

@ -11,9 +11,9 @@ declare(strict_types=1);
namespace Mailgun\Model\Event; namespace Mailgun\Model\Event;
use Mailgun\Model\PagingProvider;
use Mailgun\Model\PaginationResponse;
use Mailgun\Model\ApiResponse; use Mailgun\Model\ApiResponse;
use Mailgun\Model\PaginationResponse;
use Mailgun\Model\PagingProvider;
/** /**
* @author Tobias Nyholm <tobias.nyholm@gmail.com> * @author Tobias Nyholm <tobias.nyholm@gmail.com>

View File

@ -11,9 +11,9 @@ declare(strict_types=1);
namespace Mailgun\Model\MailingList\Member; namespace Mailgun\Model\MailingList\Member;
use Mailgun\Model\PagingProvider;
use Mailgun\Model\PaginationResponse;
use Mailgun\Model\ApiResponse; use Mailgun\Model\ApiResponse;
use Mailgun\Model\PaginationResponse;
use Mailgun\Model\PagingProvider;
final class IndexResponse implements ApiResponse, PagingProvider final class IndexResponse implements ApiResponse, PagingProvider
{ {

View File

@ -11,9 +11,9 @@ declare(strict_types=1);
namespace Mailgun\Model\MailingList; namespace Mailgun\Model\MailingList;
use Mailgun\Model\PagingProvider;
use Mailgun\Model\PaginationResponse;
use Mailgun\Model\ApiResponse; use Mailgun\Model\ApiResponse;
use Mailgun\Model\PaginationResponse;
use Mailgun\Model\PagingProvider;
final class PagesResponse implements ApiResponse, PagingProvider final class PagesResponse implements ApiResponse, PagingProvider
{ {

View File

@ -23,7 +23,7 @@ abstract class BaseResponse implements ApiResponse
private $address; private $address;
private $message; private $message;
private function __construct() final private function __construct()
{ {
} }

View File

@ -23,7 +23,7 @@ abstract class BaseResponse implements ApiResponse
private $webhook = []; private $webhook = [];
private $message; private $message;
private function __construct() final private function __construct()
{ {
} }

View File

@ -13,7 +13,6 @@ namespace Mailgun\Tests\Api;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
use Mailgun\Api\Tag; use Mailgun\Api\Tag;
use Mailgun\Mailgun;
/** /**
* @author Tobias Nyholm <tobias.nyholm@gmail.com> * @author Tobias Nyholm <tobias.nyholm@gmail.com>

View File

@ -12,10 +12,10 @@ declare(strict_types=1);
namespace Mailgun\Tests\Api; namespace Mailgun\Tests\Api;
use Mailgun\Api\Webhook; use Mailgun\Api\Webhook;
use Mailgun\Model\Webhook\IndexResponse;
use Mailgun\Model\Webhook\ShowResponse;
use Mailgun\Model\Webhook\CreateResponse; use Mailgun\Model\Webhook\CreateResponse;
use Mailgun\Model\Webhook\DeleteResponse; use Mailgun\Model\Webhook\DeleteResponse;
use Mailgun\Model\Webhook\IndexResponse;
use Mailgun\Model\Webhook\ShowResponse;
use Mailgun\Model\Webhook\UpdateResponse; use Mailgun\Model\Webhook\UpdateResponse;
class WebhookTest extends TestCase class WebhookTest extends TestCase