diff --git a/src/Util/ObjectBuilder.php b/src/Util/ObjectBuilder.php index d464f96..bbe75f0 100644 --- a/src/Util/ObjectBuilder.php +++ b/src/Util/ObjectBuilder.php @@ -83,7 +83,11 @@ public function convertArrayToObjectInstance($input, ReflectionClass $refParamet // 匿名类直接转换 if ($refParameterClass->getName() == 'stdClass') { - return json_decode(json_encode($input)); + if (empty($input)) { + return (object) $input; + } else { + return json_decode(json_encode($input)); + } } $instance = $refParameterClass->newInstanceWithoutConstructor();