Skip to content

Commit

Permalink
Fix issues caught by static analysis tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZebulanStanphill committed Oct 13, 2021
1 parent 276ad24 commit 054994c
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 10 deletions.
8 changes: 3 additions & 5 deletions src/Api/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
namespace Mailgun\Api;

use Mailgun\Assert;
use Mailgun\Exception\{
HttpClientException,
HttpServerException,
UnknownErrorException
};
use Mailgun\Exception\HttpClientException;
use Mailgun\Exception\HttpServerException;
use Mailgun\Exception\UnknownErrorException;
use Psr\Http\Message\ResponseInterface;

/**
Expand Down
1 change: 1 addition & 0 deletions src/Api/HttpApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ protected function hydrateResponse(ResponseInterface $response, string $class)
* Throw the correct exception for this error.
*
* @throws HttpClientException|HttpServerException|UnknownErrorException
*
* @return never
*/
protected function handleErrors(ResponseInterface $response): void
Expand Down
3 changes: 3 additions & 0 deletions src/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
final class Assert extends \Webmozart\Assert\Assert
{
/**
* @psalm-pure
*
* @throws InvalidArgumentException
*
* @return never
*/
protected static function reportInvalidArgument($message): void
Expand Down
3 changes: 1 addition & 2 deletions src/HttpClient/RequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ private function createRequest(
string $uri,
array $headers,
StreamInterface $stream
): RequestInterface
{
): RequestInterface {
$request = $this->getRequestFactory()->createRequest($method, $uri);
$request = $request->withBody($stream);
foreach ($headers as $name => $value) {
Expand Down
1 change: 1 addition & 0 deletions src/Hydrator/ModelHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ final class ModelHydrator implements Hydrator
* @param class-string $class
*
* @throws HydrationException
*
* @return ResponseInterface
*/
public function hydrate(ResponseInterface $response, string $class)
Expand Down
1 change: 1 addition & 0 deletions src/Hydrator/NoopHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class NoopHydrator implements Hydrator
* @param class-string $class
*
* @throws \LogicException
*
* @return never
*/
public function hydrate(ResponseInterface $response, string $class)
Expand Down
2 changes: 1 addition & 1 deletion src/Message/Exceptions/LimitExceeded.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class LimitExceeded extends \Exception implements Exception
{
public static function create(string $field, int $limit): self
public static function create(string $field, int $limit)
{
return new self(sprintf('You\'ve exceeded the maximum (%d) %s for a single message.', $limit, $field));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Message/Exceptions/TooManyRecipients.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

class TooManyRecipients extends LimitExceeded implements Exception
{
public static function create(string $field, int $limit = MessageBuilder::RECIPIENT_COUNT_LIMIT): self
public static function create(string $field, int $limit = MessageBuilder::RECIPIENT_COUNT_LIMIT)
{
return new self(sprintf('You\'ve exceeded the maximum recipient count (%s) for filed "%s".', $limit, $field));
}

public static function whenAutoSendDisabled(int $limit = MessageBuilder::RECIPIENT_COUNT_LIMIT): self
public static function whenAutoSendDisabled(int $limit = MessageBuilder::RECIPIENT_COUNT_LIMIT)
{
return new self(sprintf('You\'ve exceeded the maximum recipient count (%s) with autosend disabled.', $limit));
}
Expand Down

0 comments on commit 054994c

Please sign in to comment.