diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ce05ff3..c546d0a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * feat: Deprecate `ArrayToObjectTransformer` & `ObjectToArrayTransformer`, replace with `ArrayObjectTransformer`. * fix: Fix dynamic properties in Symfony profiler panel. +* fix: Fix `PresetTransformer`. ## 1.0.0 diff --git a/src/Transformer/Implementation/PresetTransformer.php b/src/Transformer/Implementation/PresetTransformer.php index c13263f2..47f81f18 100644 --- a/src/Transformer/Implementation/PresetTransformer.php +++ b/src/Transformer/Implementation/PresetTransformer.php @@ -40,17 +40,17 @@ public function transform( } if (!TypeCheck::isObject($targetType)) { - throw new UnexpectedValueException('Target type must be an object type'); + throw new RefuseToTransformException(); } $class = $targetType?->getClassName(); if (!is_string($class) || !class_exists($class)) { - throw new UnexpectedValueException('Target type must be a valid class name'); + throw new RefuseToTransformException(); } if (!is_object($source)) { - throw new UnexpectedValueException('Source must be an object'); + throw new RefuseToTransformException(); } try {