From 58c0485c003669c43549958e10ccf5768f54af96 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo <1102197+priyadi@users.noreply.github.com> Date: Mon, 15 Jan 2024 12:38:44 +0700 Subject: [PATCH] refactor: rename `RefuseToHandleException` to `RefuseToTransformException`. --- CHANGELOG.md | 1 + src/MainTransformer/MainTransformer.php | 4 ++-- src/Transformer/CopyTransformer.php | 4 ++-- ...seToHandleException.php => RefuseToTransformException.php} | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) rename src/Transformer/Exception/{RefuseToHandleException.php => RefuseToTransformException.php} (91%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a11bd82..f891fe4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * feat(`TryPropertyCommand`): Improve output. * dx(`TypeCheck`): Now accept `MixedType` as an argument. * test: Mapping test first version. +* refactor: rename `RefuseToHandleException` to `RefuseToTransformException`. ## 0.5.10 diff --git a/src/MainTransformer/MainTransformer.php b/src/MainTransformer/MainTransformer.php index 2e06229d..de7cc6d0 100644 --- a/src/MainTransformer/MainTransformer.php +++ b/src/MainTransformer/MainTransformer.php @@ -24,7 +24,7 @@ use Rekalogika\Mapper\Transformer\Contracts\MainTransformerAwareInterface; use Rekalogika\Mapper\Transformer\Contracts\MixedType; use Rekalogika\Mapper\Transformer\Contracts\TransformerInterface; -use Rekalogika\Mapper\Transformer\Exception\RefuseToHandleException; +use Rekalogika\Mapper\Transformer\Exception\RefuseToTransformException; use Rekalogika\Mapper\TransformerRegistry\TransformerRegistryInterface; use Rekalogika\Mapper\TypeResolver\TypeResolverInterface; use Rekalogika\Mapper\Util\TypeCheck; @@ -173,7 +173,7 @@ public function transform( targetType: $targetTypeForTransformer, context: $context ); - } catch (RefuseToHandleException) { + } catch (RefuseToTransformException) { continue; } diff --git a/src/Transformer/CopyTransformer.php b/src/Transformer/CopyTransformer.php index a4def39a..e07403fe 100644 --- a/src/Transformer/CopyTransformer.php +++ b/src/Transformer/CopyTransformer.php @@ -17,7 +17,7 @@ use Rekalogika\Mapper\Transformer\Contracts\MixedType; use Rekalogika\Mapper\Transformer\Contracts\TransformerInterface; use Rekalogika\Mapper\Transformer\Contracts\TypeMapping; -use Rekalogika\Mapper\Transformer\Exception\RefuseToHandleException; +use Rekalogika\Mapper\Transformer\Exception\RefuseToTransformException; use Rekalogika\Mapper\Util\TypeCheck; use Symfony\Component\PropertyInfo\Type; @@ -43,7 +43,7 @@ public function transform( $result = clone $source; if ($targetType !== null && !TypeCheck::isVariableInstanceOf($result, $targetType)) { - throw new RefuseToHandleException(); + throw new RefuseToTransformException(); } return $result; diff --git a/src/Transformer/Exception/RefuseToHandleException.php b/src/Transformer/Exception/RefuseToTransformException.php similarity index 91% rename from src/Transformer/Exception/RefuseToHandleException.php rename to src/Transformer/Exception/RefuseToTransformException.php index 0d3e08b7..c3507888 100644 --- a/src/Transformer/Exception/RefuseToHandleException.php +++ b/src/Transformer/Exception/RefuseToTransformException.php @@ -20,6 +20,6 @@ * able to handle the given source type in an ad-hoc basis. The main transformer * will try the next transformer for the task. */ -class RefuseToHandleException extends RuntimeException +class RefuseToTransformException extends RuntimeException { }