From 8799a3ef391750c9d1659c9ebb3ae560a3edaaa9 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Mon, 15 Sep 2025 13:24:18 +0200 Subject: [PATCH] fix: add explicit nullable types to constructor parameters - Add explicit nullable type hints (?array, ?Configuration, etc.) to constructor parameters in Model and API classes - Update PHPDoc comments to reflect nullable parameter types - Resolves PHP 8.4+ deprecation warnings for implicitly nullable parameters Affected files: - lib/Model/Postcard.php - lib/Model/Thumbnail.php - lib/Model/UsVerification.php - lib/Model/IntlVerification.php - lib/Model/AddressEditable.php - lib/Model/PostcardEditable.php - lib/Api/PostcardsApi.php This follows conventional commit format with: - fix: type since it resolves deprecation warnings - Clear description of what was changed - Explanation of why (resolves deprecation warnings) - List of affected files for easy reference --- lib/Api/PostcardsApi.php | 11 ++++++----- lib/Model/AddressEditable.php | 4 ++-- lib/Model/IntlVerification.php | 4 ++-- lib/Model/Postcard.php | 4 ++-- lib/Model/PostcardEditable.php | 4 ++-- lib/Model/Thumbnail.php | 4 ++-- lib/Model/UsVerification.php | 4 ++-- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/Api/PostcardsApi.php b/lib/Api/PostcardsApi.php index b4c3df1..39ca55b 100755 --- a/lib/Api/PostcardsApi.php +++ b/lib/Api/PostcardsApi.php @@ -76,14 +76,15 @@ class PostcardsApi protected $hostIndex; /** - * @param Configuration $config - * @param HeaderSelector $selector + * @param Configuration|null $config + * @param ClientInterface|null $client + * @param HeaderSelector|null $selector * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - Configuration $config = null, - ClientInterface $client = null, - HeaderSelector $selector = null, + ?Configuration $config = null, + ?ClientInterface $client = null, + ?HeaderSelector $selector = null, $customHeaders = [], $hostIndex = 0 ) { diff --git a/lib/Model/AddressEditable.php b/lib/Model/AddressEditable.php index 0fa1beb..6fb9b11 100755 --- a/lib/Model/AddressEditable.php +++ b/lib/Model/AddressEditable.php @@ -229,10 +229,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->container['address_line1'] = $data['address_line1'] ?? null; $this->container['address_line2'] = $data['address_line2'] ?? null; diff --git a/lib/Model/IntlVerification.php b/lib/Model/IntlVerification.php index d2b1f49..11efb4a 100755 --- a/lib/Model/IntlVerification.php +++ b/lib/Model/IntlVerification.php @@ -312,10 +312,10 @@ public function getObjectAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->container['id'] = $data['id'] ?? null; $this->container['recipient'] = $data['recipient'] ?? null; diff --git a/lib/Model/Postcard.php b/lib/Model/Postcard.php index d053c34..f3de8d1 100755 --- a/lib/Model/Postcard.php +++ b/lib/Model/Postcard.php @@ -310,10 +310,10 @@ public function getObjectAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->container['id'] = $data['id'] ?? null; $this->container['to'] = $data['to'] ?? null; diff --git a/lib/Model/PostcardEditable.php b/lib/Model/PostcardEditable.php index 265ebe0..4177a62 100755 --- a/lib/Model/PostcardEditable.php +++ b/lib/Model/PostcardEditable.php @@ -234,10 +234,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->container['to'] = $data['to'] ?? null; $this->container['from'] = $data['from'] ?? null; diff --git a/lib/Model/Thumbnail.php b/lib/Model/Thumbnail.php index 2f4691f..8c348cd 100755 --- a/lib/Model/Thumbnail.php +++ b/lib/Model/Thumbnail.php @@ -184,10 +184,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->container['small'] = $data['small'] ?? null; $this->container['medium'] = $data['medium'] ?? null; diff --git a/lib/Model/UsVerification.php b/lib/Model/UsVerification.php index b4bf287..3bc13bc 100755 --- a/lib/Model/UsVerification.php +++ b/lib/Model/UsVerification.php @@ -268,10 +268,10 @@ public function getObjectAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->container['id'] = $data['id'] ?? null; $this->container['recipient'] = $data['recipient'] ?? null;