Validation
Validation copied to clipboard
identation of nested errors are wrong in the getFullMessage()
try {
$dict = ['name' => 42, 'year' => 42];
v::keySet(
v::key('name', v::stringType()),
v::key('year', v::intVal()->between(10, 20)->in([12, 14])),
)->assert($dict);
} catch (NestedValidationException $e) {
echo $e->getFullMessage();
}
Expected
- All of the required rules must pass for { "name": 42, "year": 42 }
- name must be a string
- These rules must pass for year
- year must be less than or equal to 20
- year must be in { 12, 14 }
Current
- All of the required rules must pass for { "name": 42, "year": 42 }
- name must be a string
- These rules must pass for year
- year must be less than or equal to 20
- year must be in { 12, 14 }