Skip to content

Commit 231ab48

Browse files
committed
Fix some missing "user" to "users" changes
1 parent 99c49ad commit 231ab48

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/DB.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static function initialize(
7878
array $credentials,
7979
Telegram $telegram,
8080
$table_prefix = '',
81-
$encoding = 'utf8mb4'
81+
$encoding = 'utf8mb4',
8282
): PDO {
8383
if (empty($credentials)) {
8484
throw new TelegramException('MySQL credentials not provided!');
@@ -127,7 +127,7 @@ public static function initialize(
127127
public static function externalInitialize(
128128
PDO $external_pdo_connection,
129129
Telegram $telegram,
130-
string $table_prefix = ''
130+
string $table_prefix = '',
131131
): PDO {
132132
if ($external_pdo_connection === null) {
133133
throw new TelegramException('MySQL external connection not provided!');
@@ -300,12 +300,12 @@ protected static function getTimestamp(?int $unixtime = null): string
300300
/**
301301
* Convert array of Entity items to a JSON array
302302
*
303-
* @todo Find a better way, as json_* functions are very heavy
304-
*
305303
* @param array $entities
306304
* @param mixed $default
307305
*
308306
* @return mixed
307+
* @todo Find a better way, as json_* functions are very heavy
308+
*
309309
*/
310310
public static function entitiesArrayToJson(array $entities, $default = null)
311311
{
@@ -346,7 +346,7 @@ protected static function insertTelegramUpdate(
346346
?string $chat_member_updated_id = null,
347347
?string $chat_join_request_id = null,
348348
?string $chat_boost_updated_id = null,
349-
?string $chat_boost_removed_id = null
349+
?string $chat_boost_removed_id = null,
350350
): ?bool {
351351
if ($message_id === null && $edited_message_id === null && $channel_post_id === null && $edited_channel_post_id === null && $message_reaction_id === null && $message_reaction_count_id === null && $inline_query_id === null && $chosen_inline_result_id === null && $callback_query_id === null && $shipping_query_id === null && $pre_checkout_query_id === null && $poll_id === null && $poll_answer_poll_id === null && $my_chat_member_updated_id === null && $chat_member_updated_id === null && $chat_join_request_id === null && $chat_boost_updated_id === null && $chat_boost_removed_id === null) {
352352
throw new TelegramException('message_id, edited_message_id, channel_post_id, edited_channel_post_id, message_reaction_id, message_reaction_count_id, inline_query_id, chosen_inline_result_id, callback_query_id, shipping_query_id, pre_checkout_query_id, poll_id, poll_answer_poll_id, my_chat_member_updated_id, chat_member_updated_id, chat_join_request_id, chat_boost_updated_id, chat_boost_removed_id are all null');
@@ -539,12 +539,12 @@ public static function insertChat(Chat $chat, ?string $date = null, ?int $migrat
539539
/**
540540
* Insert request into database
541541
*
542-
* @todo self::$pdo->lastInsertId() - unsafe usage if expected previous insert fails?
543-
*
544542
* @param Update $update
545543
*
546544
* @return bool
547545
* @throws TelegramException
546+
* @todo self::$pdo->lastInsertId() - unsafe usage if expected previous insert fails?
547+
*
548548
*/
549549
public static function insertRequest(Update $update): bool
550550
{
@@ -640,7 +640,7 @@ public static function insertRequest(Update $update): bool
640640
$chat_member_updated_id,
641641
$chat_join_request_id,
642642
$chat_boost_updated_id,
643-
$chat_boost_removed_id
643+
$chat_boost_removed_id,
644644
);
645645
}
646646

@@ -1322,7 +1322,7 @@ public static function insertMessageRequest(Message $message): bool
13221322
`location`, `venue`, `poll`, `dice`, `new_chat_members`, `left_chat_member`,
13231323
`new_chat_title`, `new_chat_photo`, `delete_chat_photo`, `group_chat_created`,
13241324
`supergroup_chat_created`, `channel_chat_created`, `message_auto_delete_timer_changed`, `migrate_to_chat_id`, `migrate_from_chat_id`,
1325-
`pinned_message`, `invoice`, `successful_payment`, `user_shared`, `chat_shared`, `connected_website`, `write_access_allowed`, `passport_data`, `proximity_alert_triggered`,
1325+
`pinned_message`, `invoice`, `successful_payment`, `users_shared`, `chat_shared`, `connected_website`, `write_access_allowed`, `passport_data`, `proximity_alert_triggered`,
13261326
`forum_topic_created`, `forum_topic_edited`, `forum_topic_closed`, `forum_topic_reopened`, `general_forum_topic_hidden`, `general_forum_topic_unhidden`,
13271327
`video_chat_scheduled`, `video_chat_started`, `video_chat_ended`, `video_chat_participants_invited`, `web_app_data`, `reply_markup`
13281328
) VALUES (
@@ -1333,7 +1333,7 @@ public static function insertMessageRequest(Message $message): bool
13331333
:location, :venue, :poll, :dice, :new_chat_members, :left_chat_member,
13341334
:new_chat_title, :new_chat_photo, :delete_chat_photo, :group_chat_created,
13351335
:supergroup_chat_created, :channel_chat_created, :message_auto_delete_timer_changed, :migrate_to_chat_id, :migrate_from_chat_id,
1336-
:pinned_message, :invoice, :successful_payment, :user_shared, :chat_shared, :connected_website, :write_access_allowed, :passport_data, :proximity_alert_triggered,
1336+
:pinned_message, :invoice, :successful_payment, :users_shared, :chat_shared, :connected_website, :write_access_allowed, :passport_data, :proximity_alert_triggered,
13371337
:forum_topic_created, :forum_topic_edited, :forum_topic_closed, :forum_topic_reopened, :general_forum_topic_hidden, :general_forum_topic_unhidden,
13381338
:video_chat_scheduled, :video_chat_started, :video_chat_ended, :video_chat_participants_invited, :web_app_data, :reply_markup
13391339
)
@@ -1411,7 +1411,7 @@ public static function insertMessageRequest(Message $message): bool
14111411
$sth->bindValue(':pinned_message', $message->getPinnedMessage());
14121412
$sth->bindValue(':invoice', $message->getInvoice());
14131413
$sth->bindValue(':successful_payment', $message->getSuccessfulPayment());
1414-
$sth->bindValue(':user_shared', $message->getUserShared());
1414+
$sth->bindValue(':users_shared', $message->getUsersShared());
14151415
$sth->bindValue(':chat_shared', $message->getChatShared());
14161416
$sth->bindValue(':connected_website', $message->getConnectedWebsite());
14171417
$sth->bindValue(':write_access_allowed', $message->getWriteAccessAllowed());

tests/Unit/Entities/KeyboardButtonTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Longman\TelegramBot\Entities\KeyboardButton;
1515
use Longman\TelegramBot\Entities\KeyboardButtonPollType;
1616
use Longman\TelegramBot\Entities\KeyboardButtonRequestChat;
17-
use Longman\TelegramBot\Entities\KeyboardButtonRequestUser;
17+
use Longman\TelegramBot\Entities\KeyboardButtonRequestUsers;
1818
use Longman\TelegramBot\Entities\WebAppInfo;
1919
use Longman\TelegramBot\Exception\TelegramException;
2020
use Longman\TelegramBot\Tests\Unit\TestCase;
@@ -31,7 +31,7 @@ class KeyboardButtonTest extends TestCase
3131
public function testKeyboardButtonSuccess(): void
3232
{
3333
new KeyboardButton(['text' => 'message']);
34-
new KeyboardButton(['text' => 'message', 'request_user' => new KeyboardButtonRequestUser([])]);
34+
new KeyboardButton(['text' => 'message', 'request_users' => new KeyboardButtonRequestUsers([])]);
3535
new KeyboardButton(['text' => 'message', 'request_chat' => new KeyboardButtonRequestChat([])]);
3636
new KeyboardButton(['text' => 'message', 'request_contact' => true]);
3737
new KeyboardButton(['text' => 'message', 'request_location' => true]);
@@ -49,8 +49,8 @@ public function testInlineKeyboardButtonCouldBe(): void
4949
public function testReturnsSubentitiesOnArray()
5050
{
5151
$button = new KeyboardButton('message');
52-
$button->request_user = [];
53-
$this->assertInstanceOf(KeyboardButtonRequestUser::class, $button->getRequestUser());
52+
$button->request_users = [];
53+
$this->assertInstanceOf(KeyboardButtonRequestUsers::class, $button->getRequestUsers());
5454

5555
$button = new KeyboardButton('message');
5656
$button->request_chat = [];

0 commit comments

Comments
 (0)