From 100fd4e5a861c16b7276929b292eab91d04ceab2 Mon Sep 17 00:00:00 2001 From: BoShurik Date: Tue, 27 Jun 2023 15:47:00 +0300 Subject: [PATCH] Fix phpDoc for $allowedUpdates parameters --- CHANGELOG.md | 3 ++- src/BotApi.php | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf5fb8c7..24acbe10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ All Notable changes to `PHP Telegram Bot Api` will be documented in this file - Rename `thumb` to `thumbnail` parameter in `Animation`, `Document`, `Sticker`, `StickerSet`, `Video`, `VideoNote` types - Rename `thumb_*` to `thumbnail_*` parameter in `Inline/QueryResult` types - Add missing phpDoc for `$replyMarkup` parameters -- +- Fix phpDoc for `\TelegramBot\Api\BotApi::setWebhook` `$allowedUpdates` parameter. Automatically serialize if array passed + ### Deprecated - Deprecate using `thumb*` methods in `\TelegramBot\Api\BotApi` - Deprecate method `\TelegramBot\Api\BotApi::setStickerSetThumb`. Use `\TelegramBot\Api\BotApi::setStickerSetThumbnail` instead diff --git a/src/BotApi.php b/src/BotApi.php index c1c72676..1e69767a 100644 --- a/src/BotApi.php +++ b/src/BotApi.php @@ -527,13 +527,13 @@ public function getUserProfilePhotos($userId, $offset = 0, $limit = 100) * @param int|null $maxConnections The maximum allowed number of simultaneous HTTPS connections to the webhook * for update delivery, 1-100. Defaults to 40. Use lower values to limit * the load on your bot's server, and higher values to increase your bot's throughput. - * @param array|null $allowedUpdates A JSON-serialized list of the update types you want your bot to receive. - * For example, specify [“message”, “edited_channel_post”, “callback_query”] - * to only receive updates of these types. See Update for a complete list of available update types. - * Specify an empty list to receive all update types except chat_member (default). - * If not specified, the previous setting will be used. - * Please note that this parameter doesn't affect updates created before the call to the setWebhook, - * so unwanted updates may be received for a short period of time. + * @param array|string|null $allowedUpdates A JSON-serialized list of the update types you want your bot to receive. + * For example, specify [“message”, “edited_channel_post”, “callback_query”] + * to only receive updates of these types. See Update for a complete list of available update types. + * Specify an empty list to receive all update types except chat_member (default). + * If not specified, the previous setting will be used. + * Please note that this parameter doesn't affect updates created before the call to the setWebhook, + * so unwanted updates may be received for a short period of time. * @param bool|null $dropPendingUpdates Pass True to drop all pending updates * @param string|null $secretToken A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, * 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. @@ -557,7 +557,7 @@ public function setWebhook( 'certificate' => $certificate, 'ip_address' => $ipAddress, 'max_connections' => $maxConnections, - 'allowed_updates' => $allowedUpdates, + 'allowed_updates' => \is_array($allowedUpdates) ? json_encode($allowedUpdates) : $allowedUpdates, 'drop_pending_updates' => $dropPendingUpdates, 'secret_token' => $secretToken ]);