diff --git a/src/API/Type.php b/src/API/Type.php index c679a5c0..0d65c80c 100644 --- a/src/API/Type.php +++ b/src/API/Type.php @@ -85,11 +85,19 @@ public function castToExchange($value, $type) public static function buildFromArray($array) { + if (!is_array($array)) { + return $array; + } + if (!self::arrayIsAssoc($array)) { + foreach ($array as $key => $value) { + $array[$key] = self::buildFromArray($value); + } + return $array; } - $object = new self(); + $object = new static(); foreach ($array as $key => $value) { if (is_array($value)) { $value = self::buildFromArray($value);