From 63970f807e881419494e32685c584ba417e6c823 Mon Sep 17 00:00:00 2001 From: netkas Date: Sat, 5 Oct 2024 00:24:58 -0400 Subject: [PATCH] Updated KeyboardButtonPollType --- .../Enums/Types/KeyboardButtonPollType.php | 9 ++++++ .../Objects/KeyboardButtonPollType.php | 29 +++++++++---------- 2 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 src/TgBotLib/Enums/Types/KeyboardButtonPollType.php diff --git a/src/TgBotLib/Enums/Types/KeyboardButtonPollType.php b/src/TgBotLib/Enums/Types/KeyboardButtonPollType.php new file mode 100644 index 0000000..fe3fe41 --- /dev/null +++ b/src/TgBotLib/Enums/Types/KeyboardButtonPollType.php @@ -0,0 +1,9 @@ +type; } /** - * Returns an array representation of the object - * - * @return null[]|string[] + * @inheritDoc */ public function toArray(): array { @@ -37,16 +33,17 @@ } /** - * Constructs the object from an array representation - * - * @param array $data - * @return KeyboardButtonPollType + * @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(?array $data): ?KeyboardButtonPollType { - $object = new self(); + if ($data === null) + { + return null; + } - $object->type = $data['type'] ?? null; + $object = new self(); + $object->type = type::tryFrom($data['type']); return $object; }