From 430c5d9d4ac5db015d2391d1d0de8a1770f3940a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D1=80=D0=B8=D0=B2=D0=B8=D1=87=20=D0=A1=D0=B5=D1=80?= =?UTF-8?q?=D0=B3=D0=B5=D0=B9?= Date: Wed, 20 Jul 2022 14:54:24 +0300 Subject: [PATCH] Fix errors --- Exceptions/InvalidRequestArgumentException.php | 4 ++-- Models/Error.php | 15 ++++++++++++--- Security/AbstractClientAuthenticator.php | 5 +---- Tests/DataFixtures/RequestDto.php | 3 ++- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Exceptions/InvalidRequestArgumentException.php b/Exceptions/InvalidRequestArgumentException.php index 2d8403e..e3ebf48 100644 --- a/Exceptions/InvalidRequestArgumentException.php +++ b/Exceptions/InvalidRequestArgumentException.php @@ -9,14 +9,14 @@ class InvalidRequestArgumentException extends InvalidArgumentException { private $validateErrors; - public function __construct(string $message = "", int $code = 0, array $errors = [], Throwable $previous = null) + public function __construct(string $message = "", int $code = 0, iterable $errors = [], Throwable $previous = null) { parent::__construct($message, $code, $previous); $this->validateErrors = $errors; } - public function getValidateErrors(): array + public function getValidateErrors(): iterable { return $this->validateErrors; } diff --git a/Models/Error.php b/Models/Error.php index ae63d87..b82b62d 100644 --- a/Models/Error.php +++ b/Models/Error.php @@ -4,9 +4,18 @@ namespace RetailCrm\ServiceBundle\Models; class Error { - public string $code; + /** + * @var string + */ + public $code; - public string $message; + /** + * @var string + */ + public $message; - public array $details; + /** + * @var array + */ + public $details; } diff --git a/Security/AbstractClientAuthenticator.php b/Security/AbstractClientAuthenticator.php index 4aaafb8..500f65d 100644 --- a/Security/AbstractClientAuthenticator.php +++ b/Security/AbstractClientAuthenticator.php @@ -15,11 +15,8 @@ abstract class AbstractClientAuthenticator extends AbstractAuthenticator { public const AUTH_FIELD = 'clientId'; - private $errorResponseFactory; - - public function __construct(ErrorJsonResponseFactory $errorResponseFactory) + public function __construct(private ErrorJsonResponseFactory $errorResponseFactory) { - $this->errorResponseFactory = $errorResponseFactory; } abstract public function supports(Request $request): ?bool; diff --git a/Tests/DataFixtures/RequestDto.php b/Tests/DataFixtures/RequestDto.php index 0d68722..ee1599c 100644 --- a/Tests/DataFixtures/RequestDto.php +++ b/Tests/DataFixtures/RequestDto.php @@ -8,8 +8,9 @@ use JMS\Serializer\Annotation as JMS; class RequestDto { /** + * @var string * @Assert\NotNull() * @JMS\Type("string") */ - public string $param; + public $param; }