mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-06 08:19:25 +03:00
Minor bugfixes detected with PHPStan
This commit is contained in:
parent
dd7c1d2361
commit
34432e0517
@ -34,7 +34,7 @@ abstract class HttpApi
|
||||
protected $httpClient;
|
||||
|
||||
/**
|
||||
* @var Hydrator
|
||||
* @var null|Hydrator
|
||||
*/
|
||||
protected $hydrator;
|
||||
|
||||
@ -59,7 +59,7 @@ abstract class HttpApi
|
||||
*/
|
||||
protected function hydrateResponse(ResponseInterface $response, string $class)
|
||||
{
|
||||
if (!$this->hydrator) {
|
||||
if (null === $this->hydrator) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,9 @@ class Member extends HttpApi
|
||||
/**
|
||||
* Returns a paginated list of members of the mailing list.
|
||||
*
|
||||
* @param string $address Address of the mailing list
|
||||
* @param int $limit Maximum number of records to return (optional: 100 by default)
|
||||
* @param string|null $subscribed `true` to lists subscribed, `false` for unsubscribed. list all if null
|
||||
* @param string $address Address of the mailing list
|
||||
* @param int $limit Maximum number of records to return (optional: 100 by default)
|
||||
* @param bool|null $subscribed `true` to lists subscribed, `false` for unsubscribed. list all if null
|
||||
*
|
||||
* @return IndexResponse
|
||||
*
|
||||
|
@ -96,7 +96,7 @@ class Route extends HttpApi
|
||||
*
|
||||
* @param string $routeId Route ID returned by the Routes::index() method
|
||||
* @param string|null $expression A filter expression like "match_recipient('.*@gmail.com')"
|
||||
* @param array|null $actions Route action. This action is executed when the expression evaluates to True. Example: "forward('alice@example.com')"
|
||||
* @param array $actions Route action. This action is executed when the expression evaluates to True. Example: "forward('alice@example.com')"
|
||||
* @param string|null $description An arbitrary string
|
||||
* @param int|null $priority Integer: smaller number indicates higher priority. Higher priority routes are handled first. Defaults to 0.
|
||||
*
|
||||
|
@ -12,7 +12,10 @@ declare(strict_types=1);
|
||||
namespace Mailgun;
|
||||
|
||||
use Http\Client\Common\HttpMethodsClient;
|
||||
use Http\Client\HttpClient;
|
||||
use Mailgun\HttpClient\HttpClientConfigurator;
|
||||
use Mailgun\HttpClient\Plugin\History;
|
||||
use Mailgun\HttpClient\RequestBuilder;
|
||||
use Mailgun\Hydrator\ModelHydrator;
|
||||
use Mailgun\Hydrator\Hydrator;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
@ -28,7 +31,7 @@ final class Mailgun
|
||||
private $apiKey;
|
||||
|
||||
/**
|
||||
* @var HttpMethodsClient
|
||||
* @var HttpClient
|
||||
*/
|
||||
private $httpClient;
|
||||
|
||||
|
@ -85,7 +85,7 @@ class BatchMessage extends MessageBuilder
|
||||
$variables['id'] = $headerName.'_'.$this->counters['recipients'][$headerName];
|
||||
}
|
||||
|
||||
$this->batchRecipientAttributes[(string) $address] = $variables;
|
||||
$this->batchRecipientAttributes[$address] = $variables;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -306,9 +306,9 @@ class MessageBuilder
|
||||
throw LimitExceeded::create('campaigns', self::CAMPAIGN_ID_LIMIT);
|
||||
}
|
||||
if (isset($this->message['o:campaign'])) {
|
||||
array_push($this->message['o:campaign'], (string) $campaignId);
|
||||
array_push($this->message['o:campaign'], $campaignId);
|
||||
} else {
|
||||
$this->message['o:campaign'] = [(string) $campaignId];
|
||||
$this->message['o:campaign'] = [$campaignId];
|
||||
}
|
||||
++$this->counters['attributes']['campaign_id'];
|
||||
|
||||
|
@ -28,13 +28,10 @@ final class ConnectionResponse implements ApiResponse
|
||||
*/
|
||||
private $requireTLS;
|
||||
|
||||
/**
|
||||
* @return self
|
||||
*/
|
||||
public static function create(array $data)
|
||||
public static function create(array $data): ?self
|
||||
{
|
||||
if (!isset($data['connection'])) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
$connSettings = $data['connection'];
|
||||
|
||||
|
@ -39,7 +39,7 @@ final class Event
|
||||
private $eventDate;
|
||||
|
||||
/**
|
||||
* @var array|string[]
|
||||
* @var string[]
|
||||
*/
|
||||
private $tags = [];
|
||||
|
||||
@ -64,7 +64,7 @@ final class Event
|
||||
private $deliveryStatus;
|
||||
|
||||
/**
|
||||
* @var array|string[]
|
||||
* @var string[]
|
||||
*/
|
||||
private $campaigns = [];
|
||||
|
||||
@ -232,7 +232,7 @@ final class Event
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|\string[]
|
||||
* @return string[]
|
||||
*/
|
||||
public function getTags()
|
||||
{
|
||||
@ -240,7 +240,7 @@ final class Event
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|\string[] $tags
|
||||
* @param string[] $tags
|
||||
*/
|
||||
private function setTags($tags)
|
||||
{
|
||||
@ -296,7 +296,7 @@ final class Event
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|\string[]
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCampaigns()
|
||||
{
|
||||
@ -304,7 +304,7 @@ final class Event
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|\string[] $campaigns
|
||||
* @param string[] $campaigns
|
||||
*/
|
||||
private function setCampaigns($campaigns)
|
||||
{
|
||||
|
@ -21,49 +21,38 @@ trait PaginationResponse
|
||||
*/
|
||||
protected $paging;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNextUrl()
|
||||
public function getNextUrl(): ?string
|
||||
{
|
||||
if (!isset($this->paging['next'])) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->paging['next'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPreviousUrl()
|
||||
|
||||
public function getPreviousUrl(): ?string
|
||||
{
|
||||
if (!isset($this->paging['previous'])) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->paging['previous'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstUrl()
|
||||
public function getFirstUrl(): ?string
|
||||
{
|
||||
if (!isset($this->paging['first'])) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->paging['first'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLastUrl()
|
||||
public function getLastUrl(): ?string
|
||||
{
|
||||
if (!isset($this->paging['last'])) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->paging['last'];
|
||||
|
@ -24,7 +24,6 @@ final class Action
|
||||
/**
|
||||
* Action Named Constructor to build several Action DTOs provided by an Array.
|
||||
*
|
||||
*
|
||||
* @return Action[]
|
||||
*/
|
||||
public static function createMultiple(array $data)
|
||||
@ -38,12 +37,7 @@ final class Action
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Private Constructor.
|
||||
*
|
||||
* @param $action
|
||||
*/
|
||||
private function __construct($action)
|
||||
private function __construct(string $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ final class AllResponseItem
|
||||
* @param string $id
|
||||
* @param string $event
|
||||
* @param string $totalCount
|
||||
* @param \string[] $tags
|
||||
* @param string[] $tags
|
||||
*/
|
||||
private function __construct($id, $event, $totalCount, array $tags, \DateTime $createdAt)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user