Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
AnourValar committed Jan 12, 2023
1 parent 94e71c0 commit 25418be
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/ValidatorHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,9 @@ public function mutateArray(
foreach ($value as $key => $item) {
$path = array_merge($parentKeys, [$key]);

if ($parentKeys && ( (is_string($item) && trim($item) === '') || $item === [] )) {
foreach ((array) $nullable as $nullableKey) {
if (! $this->isMatching($nullableKey, $path)) {
continue;
}

$item = null;
$value[$key] = $item;
break;
}
}

if (is_array($item)) {
$value[$key] = $this->mutateArray($value[$key], $nullable, $purges, $types, $sorts, $lists, $path);
$item = $this->mutateArray($value[$key], $nullable, $purges, $types, $sorts, $lists, $path);
$value[$key] = $item;

foreach ((array) $sorts as $sortKey) {
if (! $this->isMatching($sortKey, $path)) {
Expand All @@ -97,7 +86,21 @@ public function mutateArray(
$value[$key] = array_values($value[$key]);
break;
}
} else {
}

if ($parentKeys && ( (is_string($item) && trim($item) === '') || $item === [] )) {
foreach ((array) $nullable as $nullableKey) {
if (! $this->isMatching($nullableKey, $path)) {
continue;
}

$item = null;
$value[$key] = $item;
break;
}
}

if (! is_array($item)) {
if ($parentKeys && is_null($item)) {
foreach ((array) $purges as $purgeKey) {
if (! $this->isMatching($purgeKey, $path)) {
Expand Down

0 comments on commit 25418be

Please sign in to comment.