Validation
Validation copied to clipboard
Bogus error message with KeySet when extra keys are provided
require 'vendor/autoload.php';
$v = \Respect\Validation\Validator::keySet(
\Respect\Validation\Validator::key("key1", \Respect\Validation\Validator::intVal())
);
try{
$v->assert(["key1" => 1, "extraKey" => 2]);
}catch(\Respect\Validation\Exceptions\NestedValidationException $e){
echo $e->getFullMessage();
}
reports the following very confusing error:
- All of the required rules must pass for `{ "key1": 1, "extraKey": 2 }`
- Must have keys `{ "key1" }`
Using version 2.2.2.