From f20f86a2fb4f37a033dbbb2edfbe91eec7c04e8a Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 4 Oct 2024 15:15:56 -0400 Subject: [PATCH] Updated ShippingAddress --- .../Objects/Payments/ShippingAddress.php | 52 +++++-------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/src/TgBotLib/Objects/Payments/ShippingAddress.php b/src/TgBotLib/Objects/Payments/ShippingAddress.php index bea8816..4941d28 100644 --- a/src/TgBotLib/Objects/Payments/ShippingAddress.php +++ b/src/TgBotLib/Objects/Payments/ShippingAddress.php @@ -7,35 +7,12 @@ class ShippingAddress implements ObjectTypeInterface { - /** - * @var string|null - */ - private $country_code; - - /** - * @var string|null - */ - private $state; - - /** - * @var string|null - */ - private $city; - - /** - * @var string|null - */ - private $street_line1; - - /** - * @var string|null - */ - private $street_line2; - - /** - * @var string|null - */ - private $post_code; + private ?string $country_code; + private ?string $state; + private ?string $city; + private ?string $street_line1; + private ?string $street_line2; + private ?string $post_code; /** * Two-letter ISO 3166-1 alpha-2 country code @@ -98,9 +75,7 @@ } /** - * Returns an array representation of the object. - * - * @return array + * @inheritDoc */ public function toArray(): array { @@ -115,15 +90,16 @@ } /** - * Constructs object from an array representation. - * - * @param array $data - * @return ShippingAddress + * @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(?array $data): ?ShippingAddress { - $object = new self(); + if($data === null) + { + return null; + } + $object = new self(); $object->country_code = $data['country_code'] ?? null; $object->state = $data['state'] ?? null; $object->city = $data['city'] ?? null;