Skip to content

Commit

Permalink
Merge pull request #30 from rekalogika:fix/presettransformer
Browse files Browse the repository at this point in the history
fix: PresetTransformer
  • Loading branch information
priyadi committed Feb 20, 2024
2 parents 86e0f4e + 86c1db3 commit dfc7607
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/Transformer/Implementation/PresetTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit dfc7607

Please sign in to comment.