ConstraintViolationList
in package
implements
IteratorAggregate, ConstraintViolationListInterface
Default implementation of {@ConstraintViolationListInterface}.
Tags
Table of Contents
Interfaces
- IteratorAggregate
- ConstraintViolationListInterface
- A list of constraint violations.
Properties
- $violations : array<int, ConstraintViolationInterface>
Methods
- __construct() : mixed
- Creates a new constraint violation list.
- __toString() : string
- Converts the violation into a string for debugging purposes.
- add() : mixed
- Adds a constraint violation to this list.
- addAll() : mixed
- Merges an existing violation list into this list.
- count() : int
- createFromMessage() : self
- findByCodes() : static
- Creates iterator for errors with specific codes.
- get() : ConstraintViolationInterface
- Returns the violation at a given offset.
- getIterator() : ArrayIterator<int, ConstraintViolationInterface>
- {@inheritdoc}
- has() : bool
- Returns whether the given offset exists.
- offsetExists() : bool
- offsetGet() : ConstraintViolationInterface
- offsetSet() : void
- offsetUnset() : void
- remove() : mixed
- Removes a violation at a given offset.
- set() : mixed
- Sets a violation at a given offset.
Properties
$violations
private
array<int, ConstraintViolationInterface>
$violations
= []
Methods
__construct()
Creates a new constraint violation list.
public
__construct([iterable<mixed, ConstraintViolationInterface> $violations = [] ]) : mixed
Parameters
- $violations : iterable<mixed, ConstraintViolationInterface> = []
-
The constraint violations to add to the list
__toString()
Converts the violation into a string for debugging purposes.
public
__toString() : string
Return values
stringadd()
Adds a constraint violation to this list.
public
add(ConstraintViolationInterface $violation) : mixed
Parameters
- $violation : ConstraintViolationInterface
addAll()
Merges an existing violation list into this list.
public
addAll(ConstraintViolationListInterface $otherList) : mixed
Parameters
- $otherList : ConstraintViolationListInterface
count()
public
count() : int
Return values
intcreateFromMessage()
public
static createFromMessage(string $message) : self
Parameters
- $message : string
Return values
selffindByCodes()
Creates iterator for errors with specific codes.
public
findByCodes(string|array<string|int, string> $codes) : static
Parameters
- $codes : string|array<string|int, string>
-
The codes to find
Return values
staticget()
Returns the violation at a given offset.
public
get(int $offset) : ConstraintViolationInterface
Parameters
- $offset : int
-
The offset of the violation
Return values
ConstraintViolationInterfacegetIterator()
{@inheritdoc}
public
getIterator() : ArrayIterator<int, ConstraintViolationInterface>
Return values
ArrayIterator<int, ConstraintViolationInterface>has()
Returns whether the given offset exists.
public
has(int $offset) : bool
Parameters
- $offset : int
-
The violation offset
Return values
booloffsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : ConstraintViolationInterface
Parameters
- $offset : mixed
Return values
ConstraintViolationInterfaceoffsetSet()
public
offsetSet(mixed $offset, mixed $violation) : void
Parameters
- $offset : mixed
- $violation : mixed
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
remove()
Removes a violation at a given offset.
public
remove(int $offset) : mixed
Parameters
- $offset : int
-
The offset to remove
set()
Sets a violation at a given offset.
public
set(int $offset, ConstraintViolationInterface $violation) : mixed
Parameters
- $offset : int
-
The violation offset
- $violation : ConstraintViolationInterface