diff --git a/src/TgBotLib/Objects/User.php b/src/TgBotLib/Objects/User.php index 06f91ad..805059d 100644 --- a/src/TgBotLib/Objects/User.php +++ b/src/TgBotLib/Objects/User.php @@ -147,9 +147,7 @@ /** - * Returns an array representation of the object - * - * @return array + * @inheritDoc */ public function toArray(): array { @@ -171,15 +169,16 @@ } /** - * Constructs an object from an array representation - * - * @param array $data - * @return static + * @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(?array $data): ?User { - $object = new self(); + if($data === null) + { + return null; + } + $object = new self(); $object->id = $data['id'] ?? null; $object->is_bot = $data['is_bot'] ?? false; $object->first_name = $data['first_name'] ?? null;