Skip to content

Commit

Permalink
Merge pull request #659 from varemel/main
Browse files Browse the repository at this point in the history
fix error in Keyboard::fromArray() method if InlineKeyboardButton button has empty query string
  • Loading branch information
fabio-ivona authored Oct 20, 2024
2 parents 95cb4d2 + e156746 commit 692bb2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Keyboard/Keyboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ public static function fromArray(array $arrayKeyboard): Keyboard
}

if (array_key_exists('switch_inline_query', $button)) {
$rowButton = $rowButton->switchInlineQuery($button['switch_inline_query']);
$rowButton = $rowButton->switchInlineQuery($button['switch_inline_query'] ?? '');

Check failure on line 88 in src/Keyboard/Keyboard.php

View workflow job for this annotation

GitHub Actions / phpstan

Offset 'switch_inline_query' on array{text: string, url?: string, callback_data?: string, web_app?: array<string>, login_url?: array<string>, switch_inline_query: string, switch_inline_query_current_chat?: string} on left side of ?? always exists and is not nullable.
}

if (array_key_exists('switch_inline_query_current_chat', $button)) {
$rowButton = $rowButton->switchInlineQuery($button['switch_inline_query_current_chat'])->currentChat();
$rowButton = $rowButton->switchInlineQuery($button['switch_inline_query_current_chat'] ?? '')->currentChat();

Check failure on line 92 in src/Keyboard/Keyboard.php

View workflow job for this annotation

GitHub Actions / phpstan

Offset 'switch_inline_query…' on array{text: string, url?: string, callback_data?: string, web_app?: array<string>, login_url?: array<string>, switch_inline_query?: string, switch_inline_query_current_chat: string} on left side of ?? always exists and is not nullable.
}

$rowButtons[] = $rowButton;
Expand Down

0 comments on commit 692bb2b

Please sign in to comment.