From 86c1db3f8426e47e47769280e14114a7e70f4239 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo <1102197+priyadi@users.noreply.github.com> Date: Tue, 20 Feb 2024 22:02:52 +0700 Subject: [PATCH] fix: PresetTransformer --- CHANGELOG.md | 1 + src/Transformer/Implementation/PresetTransformer.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) 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 {