From 75fb7591006cf56926e3212f7fd494160d7accb0 Mon Sep 17 00:00:00 2001 From: netkas Date: Sat, 5 Oct 2024 00:49:53 -0400 Subject: [PATCH] Updated PollOption --- src/TgBotLib/Objects/PollOption.php | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/TgBotLib/Objects/PollOption.php b/src/TgBotLib/Objects/PollOption.php index 02b914a..b13e017 100644 --- a/src/TgBotLib/Objects/PollOption.php +++ b/src/TgBotLib/Objects/PollOption.php @@ -7,15 +7,8 @@ class PollOption implements ObjectTypeInterface { - /** - * @var string - */ - private $text; - - /** - * @var int - */ - private $voter_count; + private string $text; + private int $voter_count; /** * Option text, 1-100 characters @@ -38,9 +31,7 @@ } /** - * Returns an array representation of the object - * - * @return array + * @inheritDoc */ public function toArray(): array { @@ -51,15 +42,16 @@ } /** - * Constructs an object from an array representation - * - * @param array $data - * @return PollOption + * @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(?array $data): ?PollOption { - $object = new self(); + if($data === null) + { + return null; + } + $object = new self(); $object->text = $data['text'] ?? null; $object->voter_count = $data['voter_count'] ?? null;