im using https://github.com/Respect/Validation for validation. the package looked verry good so now i wanted to try it. I wanted to add some validation rules to a (decoded) jtw token, wich is a php object. and the validation method worked.
Now i wanted to add error messages but those do not seem to work?
public function validateJwt($request, $response)
{
$validator = v::objectType()->attribute('data');
$validator->validate($this->jwt);
var_dump($validator->validate($this->jwt)); // <-- this returns true
try {
$validator->assert('JWT');
} catch(NestedValidationException $exception) {
print_r($exception->getMessages());
/*
Array
(
[0] => "JWT" must be an object
[1] => Attribute data must be present
)
*/
}
}
Why am I getting these messages because on the validate method, it returns true..