From c1eec26a2ca2a3e63990a854f0b892ace56f4e3a Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 4 Oct 2024 21:12:50 -0400 Subject: [PATCH] Updated ForumTopic --- src/TgBotLib/Objects/ForumTopic.php | 40 +++++++++-------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/src/TgBotLib/Objects/ForumTopic.php b/src/TgBotLib/Objects/ForumTopic.php index 30b8bca..cf2b6ec 100644 --- a/src/TgBotLib/Objects/ForumTopic.php +++ b/src/TgBotLib/Objects/ForumTopic.php @@ -7,25 +7,10 @@ class ForumTopic implements ObjectTypeInterface { - /** - * @var int - */ - private $message_thread_id; - - /** - * @var string - */ - private $name; - - /** - * @var int - */ - private $icon_color; - - /** - * @var string|null - */ - private $icon_custom_emoji_id; + private int $message_thread_id; + private string $name; + private int $icon_color; + private ?string $icon_custom_emoji_id; /** * Unique identifier of the forum topic @@ -68,9 +53,7 @@ } /** - * Returns an array representation of the object - * - * @return array + * @inheritDoc */ public function toArray(): array { @@ -83,15 +66,16 @@ } /** - * Constructs object from an array representation - * - * @param array $data - * @return ForumTopic + * @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(?array $data): ?ForumTopic { - $object = new self(); + if($data === null) + { + return null; + } + $object = new self(); $object->message_thread_id = $data['message_thread_id'] ?? null; $object->name = $data['name'] ?? null; $object->icon_color = $data['icon_color'] ?? null;