Skip to content

Commit

Permalink
style: Rename variables for uniformity
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Jan 14, 2024
1 parent 819cc47 commit 79873e6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Transformer/TraversableToTraversableTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ public function transform(
// if target has int key type but the source has string key type,
// we discard the source key & use null (i.e. $target[] = $value)

$targetPropertyKey = null;
$targetMemberKey = null;
$path = sprintf('[%d]', $i);
} else {
$targetPropertyKey = $sourcePropertyKey;
$targetMemberKey = $sourcePropertyKey;
$path = sprintf('[%s]', $sourcePropertyKey);
}
} else {
Expand All @@ -115,33 +115,33 @@ public function transform(
// the target

/** @var mixed */
$targetPropertyKey = $this->getMainTransformer()->transform(
$targetMemberKey = $this->getMainTransformer()->transform(
source: $sourcePropertyKey,
target: null,
targetTypes: $targetMemberKeyType,
context: $context,
);

if ($targetPropertyKey instanceof \Stringable) {
$path = sprintf('[%s]', $targetPropertyKey);
if ($targetMemberKey instanceof \Stringable) {
$path = sprintf('[%s]', $targetMemberKey);
} else {
$path = sprintf('[%s]', get_debug_type($targetPropertyKey));
$path = sprintf('[%s]', get_debug_type($targetMemberKey));
}
}

// now transform the source member value to the type of the target
// member value

/** @var mixed */
$targetPropertyValue = $this->getMainTransformer()->transform(
$targetMemberValue = $this->getMainTransformer()->transform(
source: $sourcePropertyValue,
target: null,
targetTypes: $targetMemberValueType,
context: $context,
path: $path,
);

yield $targetPropertyKey => $targetPropertyValue;
yield $targetMemberKey => $targetMemberValue;

$i++;
}
Expand Down

0 comments on commit 79873e6

Please sign in to comment.