From 527476be1843c4365fa8813e094783a04199740c Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 21 Jun 2019 17:33:25 +0300 Subject: [PATCH] Several fixes --- src/Bot/Client.php | 12 ++++++------ src/Bot/HttpClient.php | 5 +++++ src/Bot/Model/Request/CommandEditRequest.php | 7 +++---- src/Bot/Model/Request/DialogAssignRequest.php | 2 ++ tests/Bot/Tests/FileTest.php | 2 -- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Bot/Client.php b/src/Bot/Client.php index 47f0ab4..1006032 100644 --- a/src/Bot/Client.php +++ b/src/Bot/Client.php @@ -63,12 +63,12 @@ class Client } /** - * @param string $path - * @param string $method - * @param object $request Request parameters - * @param string $responseType - * @param string $serializeTo - * @param bool $arrayOfObjects + * @param string $path + * @param string $method + * @param object|null $request Request parameters + * @param string $responseType + * @param string $serializeTo + * @param bool $arrayOfObjects * * @return object|null * @throws \Exception diff --git a/src/Bot/HttpClient.php b/src/Bot/HttpClient.php index 6eda64a..dea1bc3 100644 --- a/src/Bot/HttpClient.php +++ b/src/Bot/HttpClient.php @@ -260,6 +260,11 @@ class HttpClient } } + /** + * @param array $errors + * + * @return string + */ private function getErrors(array $errors) { $errorString = ''; diff --git a/src/Bot/Model/Request/CommandEditRequest.php b/src/Bot/Model/Request/CommandEditRequest.php index e95161d..cdf6033 100644 --- a/src/Bot/Model/Request/CommandEditRequest.php +++ b/src/Bot/Model/Request/CommandEditRequest.php @@ -13,6 +13,7 @@ namespace RetailCrm\Mg\Bot\Model\Request; +use JMS\Serializer\Annotation as Serializer; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\SkipWhenEmpty; use JMS\Serializer\Annotation\Type; @@ -35,8 +36,7 @@ class CommandEditRequest * * @Type("int") * @Accessor(getter="getBotId",setter="setBotId") - * - * @Assert\NotBlank + * @SkipWhenEmpty() */ private $botId; @@ -45,8 +45,7 @@ class CommandEditRequest * * @Type("string") * @Accessor(getter="getName",setter="setName") - * - * @Assert\NotBlank + * @SkipWhenEmpty() */ private $name; diff --git a/src/Bot/Model/Request/DialogAssignRequest.php b/src/Bot/Model/Request/DialogAssignRequest.php index f46d7ed..e5aabf6 100644 --- a/src/Bot/Model/Request/DialogAssignRequest.php +++ b/src/Bot/Model/Request/DialogAssignRequest.php @@ -13,6 +13,7 @@ namespace RetailCrm\Mg\Bot\Model\Request; +use JMS\Serializer\Annotation as Serializer; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\SkipWhenEmpty; use JMS\Serializer\Annotation\Type; @@ -34,6 +35,7 @@ class DialogAssignRequest * * @Type("int") * @Accessor(getter="getDialogId", setter="setDialogId") + * @SkipWhenEmpty() */ private $dialogId; diff --git a/tests/Bot/Tests/FileTest.php b/tests/Bot/Tests/FileTest.php index 6529945..430ba1c 100644 --- a/tests/Bot/Tests/FileTest.php +++ b/tests/Bot/Tests/FileTest.php @@ -13,8 +13,6 @@ namespace RetailCrm\Mg\Bot\Tests; -use RetailCrm\Mg\Bot\Model\Constants; -use RetailCrm\Mg\Bot\Model\Request\MessageSendRequest; use RetailCrm\Mg\Bot\Model\Response\FullFileResponse; use RetailCrm\Mg\Bot\Model\Response\UploadFileResponse; use RetailCrm\Mg\Bot\Test\TestCase;