symfony/symfony — pull request #8429 by entering (2013-07-06 23:32:35+00:00)
Title: [Validator] Constaint Violation List add isEmpty()

At http://symfony.com/doc/current/book/validation.html

```php
$validator = $this->get('validator');
$errors = $validator->validate($author);

if (count($errors) > 0) {
return new Response(print_r($errors, true));
} else {
return new Response('The author is valid! Yes!');
}
```

While doing this code several times, to me doing a count every time doesn't look good, I would prefer to have a isEmpty()

```php
$validator = $this->get('validator');
$violations = $validator->validate($author);

if ($violations->isEmpty()) {
return new Response('The author is valid! Yes!');
} else {
return new Response(print_r($errors, true));
}
```

The isEmpty() just compare against array dropping the count.