Skip to content

Commit

Permalink
fix: rule differs and matches with dot array
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Aug 3, 2024
1 parent ab82f41 commit 156e45b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions system/Validation/StrictRules/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ public function differs(
return $str !== dot_array_search($otherField, $data);
}

if (! array_key_exists($field, $data)) {
if (! array_key_exists($otherField, $data)) {
return false;
}

if (! array_key_exists($otherField, $data)) {
if (str_contains($field, '.')) {
if (! ArrayHelper::dotKeyExists($field, $data)) {
return false;
}
} elseif (! array_key_exists($field, $data)) {
return false;
}

Expand Down Expand Up @@ -281,11 +285,15 @@ public function matches(
return $str === dot_array_search($otherField, $data);
}

if (! array_key_exists($field, $data)) {
if (! array_key_exists($otherField, $data)) {
return false;
}

if (! array_key_exists($otherField, $data)) {
if (str_contains($field, '.')) {
if (! ArrayHelper::dotKeyExists($field, $data)) {
return false;
}
} elseif (! array_key_exists($field, $data)) {
return false;
}

Expand Down

0 comments on commit 156e45b

Please sign in to comment.