Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated: Creation of dynamic property TelegramBot\Entities\InlineKeyboardButton #10

Closed
essential-writer-codebase opened this issue Jun 23, 2024 · 1 comment · Fixed by #11

Comments

@essential-writer-codebase

PHP 8.3

For example if y send this Request

        Request::sendMessage([
            'chat_id' => $chat_id,
            'parse_mode' => ParseMode::MARKDOWN,
            'text' => "test message",
            'reply_markup' => InlineKeyboard::make()->setKeyboard([
                [
                    InlineKeyboardButton::make->setText("test")->setSwitchInlineQuery($message)
                ]
            ])
        ]);

I haved this error:
Deprecated: Creation of dynamic property TelegramBot\Entities\InlineKeyboardButton::$text is deprecated

If i send this request with setText()

        Request::sendMessage([
            'chat_id' => $chat_id,
            'parse_mode' => ParseMode::MARKDOWN,
            'text' => "test message",
            'reply_markup' => InlineKeyboard::make()->setKeyboard([
                [
                    InlineKeyboardButton::make->setText("test")->setSwitchInlineQuery($message)
                ]

            ])
        ]);

I haved this error:
Fatal error: Uncaught TypeError: TelegramBot\CrashPad::sendCrash(): Argument #3 ($update) must be of type ?string, false given, called in /var/www/vendor/telegram-bot-php/core/src/CrashPad.php on line 29 and defined in /var/www/vendor/telegram-bot-php/core/src/CrashPad.php:72 Stack trace: #0 /var/www/vendor/telegram-bot-php/core/src/CrashPad.php(29): TelegramBot\CrashPad::sendCrash() #1 [internal function]: TelegramBot\CrashPad::TelegramBot{closure}() #2 {main} thrown in /var/www/vendor/telegram-bot-php/core/src/CrashPad.php on line 72

@shahradelahi
Copy link
Member

Hey @essential-writer-codebase,

There are a couple of use cases in the tests/KeyboardTest.php file.

And the deprecation message is a warning message and can be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants