From ad1094de384fdfb03950b6fca8f19735e3053642 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 4 Oct 2024 00:16:11 -0400 Subject: [PATCH] Updated ChosenInlineResult --- .../Objects/Inline/ChosenInlineResult.php | 42 ++++--------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/TgBotLib/Objects/Inline/ChosenInlineResult.php b/src/TgBotLib/Objects/Inline/ChosenInlineResult.php index 75e81cb..10db15e 100644 --- a/src/TgBotLib/Objects/Inline/ChosenInlineResult.php +++ b/src/TgBotLib/Objects/Inline/ChosenInlineResult.php @@ -10,30 +10,11 @@ class ChosenInlineResult implements ObjectTypeInterface { - /** - * @var string - */ - private $result_id; - - /** - * @var User - */ - private $from; - - /** - * @var Location|null - */ - private $location; - - /** - * @var string|null - */ - private $inline_message_id; - - /** - * @var string - */ - private $query; + private string $result_id; + private User $from; + private ?Location $location; + private ?string $inline_message_id; + private string $query; /** * The unique identifier for the result that was chosen @@ -90,26 +71,21 @@ } /** - * Returns an array representation of the object - * - * @return array + * @inheritDoc */ public function toArray(): array { return [ 'result_id' => $this->result_id, - 'from' => ($this->from instanceof ObjectTypeInterface) ? $this->from->toArray() : $this->from, - 'location' => ($this->location instanceof ObjectTypeInterface) ? $this->location->toArray() : $this->location, + 'from' => $this->from?->toArray(), + 'location' => $this->location?->toArray(), 'inline_message_id' => $this->inline_message_id, 'query' => $this->query, ]; } /** - * Constructs object from an array representation - * - * @param array|null $data - * @return ChosenInlineResult|null + * @inheritDoc */ public static function fromArray(?array $data): ?ChosenInlineResult {