You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I'm building a new message via SendMessageMethod I'm passing an entities list that cannot be normalized by BotApiNormalizer. It just ignores them and still appears as an array instead of encoded json.
I didn't know that array of objects should be encoded manually. I found this in the similar methods accepts array of objects.
// TgBotApi\BotApiBase\Method\AnswerShippingQueryMethod.php/** * Optional. Required if ok is True. A JSON-serialized array of available shipping options. * * @var ShippingOption[]|null */public$shippingOptions;
A JSON-serialized array of available shipping options.
But documentation for the entities property misses this:
// TgBotApi\BotApiBase\Method\SendMessageMethod.php/** * Optional. List of special entities that appear in message text, which can be specified instead of parse_mode. * * @var MessageEntityType[]|null */public$entities;
Also, the type of property should be string if it accepts encoded string?
psalm: $sendMessage->entities with declared type 'array<array-key, TgBotApi\BotApiBase\Type\MessageEntityType>|null' cannot be assigned type 'false|string'
wakebit
changed the title
MessageEntityType cannot be normalized
Entities property of SendMessageMethod misses important comment
Apr 24, 2022
Detailed description
When I'm building a new message via
SendMessageMethod
I'm passing an entities list that cannot be normalized byBotApiNormalizer
. It just ignores them and still appears as an array instead of encoded json.And this method cannot be sent by the api client:
Your environment
Include as many relevant details about the environment you experienced the bug in and how to reproduce it.
The text was updated successfully, but these errors were encountered: