Closed
Description
Currently, checking whether validation succeeded (regardless of the violations) is quite expressive. What about adding methods ok()
and notOk()
to ConstraintViolationList
which can be used in a fluent call?
// instead of
if (0 === count($validator->validate($object))) { ... }
// do
if ($validator->validate($object)->ok()) { ... }
// instead of
if (count($validator->validate($object)) > 0) { ... }
// do
if ($validator->validate($object)->notOk()) { ... }