4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Validator;
15 * A list of constraint violations.
17 * @author Bernhard Schussek <bschussek@gmail.com>
19 interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess
22 * Adds a constraint violation to this list.
24 * @param ConstraintViolationInterface $violation The violation to add
26 public function add(ConstraintViolationInterface $violation);
29 * Merges an existing violation list into this list.
31 * @param ConstraintViolationListInterface $otherList The list to merge
33 public function addAll(ConstraintViolationListInterface $otherList);
36 * Returns the violation at a given offset.
38 * @param int $offset The offset of the violation
40 * @return ConstraintViolationInterface The violation
42 * @throws \OutOfBoundsException If the offset does not exist.
44 public function get($offset);
47 * Returns whether the given offset exists.
49 * @param int $offset The violation offset
51 * @return bool Whether the offset exists
53 public function has($offset);
56 * Sets a violation at a given offset.
58 * @param int $offset The violation offset
59 * @param ConstraintViolationInterface $violation The violation
61 public function set($offset, ConstraintViolationInterface $violation);
64 * Removes a violation at a given offset.
66 * @param int $offset The offset to remove
68 public function remove($offset);