From 23b69ae8430370f39c6ac8311c66b3fce7880a3b Mon Sep 17 00:00:00 2001 From: Andrii Kleban Date: Wed, 15 Jun 2022 13:23:18 +0300 Subject: [PATCH 1/2] fix: Fixed enum serialization with null values. --- composer.json | 2 +- src/TenantCloud/DataTransferObjects/IsDataTransferObject.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 5293db6..9b603e6 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "ext-json": "*", "illuminate/support": "^8.0 || ^9.0", "spatie/macroable": "1.0.1", - "tenantcloud/php-standard": "^1.2" + "tenantcloud/php-standard": "^1.4" }, "require-dev": { "phpunit/phpunit": "^9.0", diff --git a/src/TenantCloud/DataTransferObjects/IsDataTransferObject.php b/src/TenantCloud/DataTransferObjects/IsDataTransferObject.php index 3428a6c..24ebe3c 100644 --- a/src/TenantCloud/DataTransferObjects/IsDataTransferObject.php +++ b/src/TenantCloud/DataTransferObjects/IsDataTransferObject.php @@ -94,11 +94,11 @@ public function __unserialize(array $data): void if (is_iterable($serializedItem)) { foreach ($serializedItem as $key => $item) { - Arr::set($dataItems[$index], $key, $enum::fromValue($item)); + Arr::set($dataItems[$index], $key, $item === null ? $item : $enum::fromValue($item)); } } else { /* @var ValueEnum|null $enum */ - Arr::set($dataItems, $index, $enum::fromValue($serializedItem)); + Arr::set($dataItems, $index, $serializedItem === null ? $serializedItem : $enum::fromValue($serializedItem)); } } } From e0d16aba55e4270a2e628969826f83bc81e862f2 Mon Sep 17 00:00:00 2001 From: Andrii Kleban Date: Wed, 15 Jun 2022 13:27:16 +0300 Subject: [PATCH 2/2] config: Resolve dependency for php 7.4 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9b603e6..e5e8607 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "ext-json": "*", "illuminate/support": "^8.0 || ^9.0", "spatie/macroable": "1.0.1", - "tenantcloud/php-standard": "^1.4" + "tenantcloud/php-standard": "1.2 || ^1.4" }, "require-dev": { "phpunit/phpunit": "^9.0",