Skip to content

Commit

Permalink
array: test if key value is not empty before testing if the key is an…
Browse files Browse the repository at this point in the history
… array.

Signed-off-by: Thibault JUNIN <[email protected]>
  • Loading branch information
thibaultjunin committed Mar 21, 2022
1 parent ea1c527 commit 9c87461
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function email(string ...$keys): self
public function array(string ...$keys): self
{
foreach ($keys as $key) {
if (!is_array($this->getValue($key))) {
if (!empty($this->getValue($key)) && !is_array($this->getValue($key))) {
$this->addError($key, ValidationRules::ARRAY);
}
}
Expand Down

0 comments on commit 9c87461

Please sign in to comment.