Skip to content

Commit

Permalink
dx: Clarity.
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Jan 16, 2024
1 parent 62e5260 commit d0149da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* docs: Add rationale.
* fix: Add variance safeguard.
* dx: Clarity.

## 0.5.12

Expand Down
6 changes: 5 additions & 1 deletion src/TransformerRegistry/TransformerRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public function findBySourceAndTargetType(
$searchResultEntries = [];

foreach ($mapping as $mappingEntry) {
if ($mappingEntry->isVariantTargetType() || !TypeCheck::isObject($targetType)) {
if ($mappingEntry->isVariantTargetType()) {
// if variant

$searchResultEntry = new SearchResultEntry(
mappingOrder: $mappingEntry->getOrder(),
sourceType: $sourceType,
Expand All @@ -70,6 +72,8 @@ public function findBySourceAndTargetType(

$searchResultEntries[] = $searchResultEntry;
} else {
// if invariant, check if target type is somewhat identical

if (
TypeCheck::isSomewhatIdentical(
$targetType,
Expand Down

0 comments on commit d0149da

Please sign in to comment.