From dd078f0ab2f47a2ee22015efbab5ba67f6c7ee06 Mon Sep 17 00:00:00 2001 From: Roman Lytvynenko Date: Sat, 19 Oct 2024 09:06:22 +0300 Subject: [PATCH] fixed mixed format serialization --- src/Support/Generator/Schema.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Support/Generator/Schema.php b/src/Support/Generator/Schema.php index 7e74ee81..2ba3ec6e 100644 --- a/src/Support/Generator/Schema.php +++ b/src/Support/Generator/Schema.php @@ -30,9 +30,21 @@ private function setType(Type $type) public function toArray() { - return array_merge($this->type->toArray(), array_filter([ + $typeArray = $this->type->toArray(); + + if ($typeArray instanceof \stdClass) { // mixed + $typeArray = []; + } + + $result = array_merge($typeArray, array_filter([ 'title' => $this->title, ])); + + if (empty($result)) { + return (object) []; + } + + return $result; } public static function createFromParameters(array $parameters)