diff --git a/src/TgBotLib/Objects/PhotoSize.php b/src/TgBotLib/Objects/PhotoSize.php index d75f996..0b8699d 100644 --- a/src/TgBotLib/Objects/PhotoSize.php +++ b/src/TgBotLib/Objects/PhotoSize.php @@ -7,30 +7,11 @@ class PhotoSize implements ObjectTypeInterface { - /** - * @var string - */ - private $file_id; - - /** - * @var string - */ - private $file_unique_id; - - /** - * @var string - */ - private $width; - - /** - * @var string - */ - private $height; - - /** - * @var int|null - */ - private $file_size; + private string $file_id; + private string $file_unique_id; + private string $width; + private string $height; + private ?int $file_size; /** * Identifier for this file, which can be used to download or reuse the file @@ -85,9 +66,7 @@ } /** - * Returns an array representation of the object - * - * @return array + * @inheritDoc */ public function toArray(): array { @@ -101,16 +80,16 @@ } /** - * Constructs an object from an array representation - * - * @param array $data - * @return PhotoSize - * @noinspection DuplicatedCode + * @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(?array $data): ?PhotoSize { - $object = new self(); + if($data === null) + { + return null; + } + $object = new self(); $object->file_id = $data['file_id'] ?? null; $object->file_unique_id = $data['file_unique_id'] ?? null; $object->width = $data['width'] ?? null;