@@ -43,7 +43,11 @@ public function testDotKeyExists(): void
4343 $ this ->assertTrue (ArrayHelper ::dotKeyExists ('contacts.friends ' , $ this ->array ));
4444 $ this ->assertFalse (ArrayHelper ::dotKeyExists ('not.friends ' , $ this ->array ));
4545 $ this ->assertTrue (ArrayHelper ::dotKeyExists ('contacts.friends.0.name ' , $ this ->array ));
46+ $ this ->assertFalse (ArrayHelper ::dotKeyExists ('contacts.friends.0.nonexistent ' , $ this ->array ));
4647 $ this ->assertFalse (ArrayHelper ::dotKeyExists ('contacts.friends.1.name ' , $ this ->array ));
48+ $ this ->assertFalse (ArrayHelper ::dotKeyExists ('0 ' , []));
49+ $ this ->assertFalse (ArrayHelper ::dotKeyExists ('contacts.friends.0.name.sub ' , $ this ->array ));
50+ $ this ->assertFalse (ArrayHelper ::dotKeyExists ('contacts.friends.1.age.sub ' , $ this ->array ));
4751 }
4852
4953 public function testDotKeyExistsWithEndingWildCard (): void
@@ -72,6 +76,9 @@ public function testDotKeyExistsWithWildCard(): void
7276 $ this ->assertTrue (ArrayHelper ::dotKeyExists ('contacts.*.0.age ' , $ this ->array ));
7377 $ this ->assertTrue (ArrayHelper ::dotKeyExists ('contacts.*.1.age ' , $ this ->array ));
7478 $ this ->assertTrue (ArrayHelper ::dotKeyExists ('contacts.*.0.name ' , $ this ->array ));
79+ $ this ->assertFalse (ArrayHelper ::dotKeyExists ('contacts.*.0.nonexistent ' , $ this ->array ));
7580 $ this ->assertFalse (ArrayHelper ::dotKeyExists ('contacts.*.1.name ' , $ this ->array ));
81+ $ this ->assertFalse (ArrayHelper ::dotKeyExists ('contacts.friends.*.age.sub ' , $ this ->array ));
82+ $ this ->assertFalse (ArrayHelper ::dotKeyExists ('contacts.friends.1.age.*.sub ' , $ this ->array ));
7683 }
7784}
0 commit comments