Skip to content

Commit

Permalink
Merge pull request #687 from varemel/main
Browse files Browse the repository at this point in the history
Incorrect array PHPDOC declaration in Keyboard::fromArray() method cause phpstan wrong autocorrection
  • Loading branch information
fabio-ivona authored Jan 28, 2025
2 parents 56c1a8e + d287a53 commit 73f63ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Keyboard/Keyboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function clone(): Keyboard
}

/**
* @param array<array-key, array<array-key, array{text: string, url?: string, callback_data?: string, web_app?: string[], login_url?: string[], switch_inline_query?: string, switch_inline_query_current_chat?: string}>> $arrayKeyboard
* @param array<array-key, array<array-key, array{text: string, url?: string, callback_data?: string, web_app?: string[], login_url?: string[], switch_inline_query?: string|null, switch_inline_query_current_chat?: string|null}>> $arrayKeyboard
*
* @return Keyboard
*/
Expand Down 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'] ?? '');
}

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();
}

$rowButtons[] = $rowButton;
Expand Down

0 comments on commit 73f63ed

Please sign in to comment.