From 7dce9a5f8ead2488ce0cf7737d00dbfea80a1bd5 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 4 Oct 2024 15:04:16 -0400 Subject: [PATCH] Updated Dice --- src/TgBotLib/Objects/Dice.php | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/TgBotLib/Objects/Dice.php b/src/TgBotLib/Objects/Dice.php index 4aac86b..7a64cda 100644 --- a/src/TgBotLib/Objects/Dice.php +++ b/src/TgBotLib/Objects/Dice.php @@ -7,15 +7,8 @@ class Dice implements ObjectTypeInterface { - /** - * @var string - */ - private $emoji; - - /** - * @var int - */ - private $value; + private string $emoji; + private int $value; /** * @return string @@ -34,9 +27,7 @@ } /** - * Constructs object from array representation - * - * @return array + * @inheritDoc */ public function toArray(): array { @@ -47,15 +38,16 @@ } /** - * Constructs object from array representation - * - * @param array $data - * @return Dice + * @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(?array $data): ?Dice { - $object = new self(); + if($data === null) + { + return null; + } + $object = new self(); $object->emoji = $data['emoji'] ?? null; $object->value = $data['value'] ?? null;