From 64ab30509e5051b2335655a5d5bbd58dae94bf88 Mon Sep 17 00:00:00 2001 From: Gabriel Solomon Date: Tue, 2 Apr 2024 22:55:46 +0300 Subject: [PATCH] refactor: add nullable types --- src/Model/CustomerDetails.php | 11 +++++------ src/Responses/BaseResponse.php | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Model/CustomerDetails.php b/src/Model/CustomerDetails.php index 4d839ef..06bb78a 100644 --- a/src/Model/CustomerDetails.php +++ b/src/Model/CustomerDetails.php @@ -28,10 +28,9 @@ class CustomerDetails private ?string $contact; /** - * @var DeliveryInfo * @Serializer\Type("Stev\BTIPay\Model\DeliveryInfo") */ - private DeliveryInfo $deliveryInfo; + private ?DeliveryInfo $deliveryInfo = null; /** * @var BillingInfo @@ -102,18 +101,18 @@ public function setContact($contact): static } /** - * @return DeliveryInfo + * @return DeliveryInfo|null */ - public function getDeliveryInfo(): DeliveryInfo + public function getDeliveryInfo(): ?DeliveryInfo { return $this->deliveryInfo; } /** - * @param DeliveryInfo $deliveryInfo + * @param DeliveryInfo|null $deliveryInfo * @return CustomerDetails */ - public function setDeliveryInfo(DeliveryInfo $deliveryInfo): static + public function setDeliveryInfo(?DeliveryInfo $deliveryInfo): static { $this->deliveryInfo = $deliveryInfo; diff --git a/src/Responses/BaseResponse.php b/src/Responses/BaseResponse.php index a491f5c..68f0937 100644 --- a/src/Responses/BaseResponse.php +++ b/src/Responses/BaseResponse.php @@ -12,10 +12,9 @@ class BaseResponse implements ResponseInterface /** - * @var int * @Serializer\Type("int") */ - protected int $errorCode; + protected ?int $errorCode = null; /** * @var string @@ -24,18 +23,18 @@ class BaseResponse implements ResponseInterface protected string $errorMessage; /** - * @return int + * @return int|null */ - public function getErrorCode(): int + public function getErrorCode(): ?int { return $this->errorCode; } /** - * @param int $errorCode + * @param int|null $errorCode * @return BaseResponse */ - public function setErrorCode($errorCode): static + public function setErrorCode(?int $errorCode): static { $this->errorCode = $errorCode;