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