Skip to content

Commit 76b4345

Browse files
authored
Merge pull request #96 from ThHareau/master
TypeError in arrayUnset
2 parents eec567d + ace404e commit 76b4345

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public static function arraySet(&$target, $key, $value, $overwrite = true): arra
172172
* @param string|array $key
173173
* @return mixed
174174
*/
175-
public static function arrayUnset(&$target, $key): array
175+
public static function arrayUnset(&$target, $key)
176176
{
177177
if (!is_array($target)) {
178178
return $target;

tests/ValidatorTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,16 @@ public function testArrayAssocValidation()
804804
$this->assertNull($errors->first('user.name:required'));
805805
}
806806

807+
public function testEmptyArrayAssocValidation()
808+
{
809+
$validation = $this->validator->validate([], [
810+
'user'=> 'required',
811+
'user.email' => 'email',
812+
]);
813+
814+
$this->assertFalse($validation->passes());
815+
}
816+
807817
/**
808818
* Test root asterisk validation.
809819
*

0 commit comments

Comments
 (0)