Skip to content

Commit 045836e

Browse files
committed
TypeError in arrayUnset
1 parent 6396c98 commit 045836e

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
@@ -165,7 +165,7 @@ public static function arraySet(&$target, $key, $value, $overwrite = true): arra
165165
* @param string|array $key
166166
* @return mixed
167167
*/
168-
public static function arrayUnset(&$target, $key): array
168+
public static function arrayUnset(&$target, $key)
169169
{
170170
if (!is_array($target)) {
171171
return $target;

tests/ValidatorTest.php

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

806+
public function testEmptyArrayAssocValidation()
807+
{
808+
$validation = $this->validator->validate([], [
809+
'user'=> 'required',
810+
'user.email' => 'email',
811+
]);
812+
813+
$this->assertFalse($validation->passes());
814+
}
815+
806816
public function testArrayValidation()
807817
{
808818
$validation = $this->validator->validate([

0 commit comments

Comments
 (0)