ConstraintViolationList
in package
implements
IteratorAggregate, ConstraintViolationListInterface
Default implementation of {@ConstraintViolationListInterface}.
Tags
Interfaces, Classes, Traits and Enums
- IteratorAggregate
- ConstraintViolationListInterface
- A list of constraint violations.
Table of Contents
- $violations : array<string|int, ConstraintViolationInterface>
- __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
- findByCodes() : static
- Creates iterator for errors with specific codes.
- get() : ConstraintViolationInterface
- Returns the violation at a given offset.
- getIterator() : ArrayIterator|array<string|int, ConstraintViolationInterface>
- {@inheritdoc}
- has() : bool
- Returns whether the given offset exists.
- offsetExists() : bool
- offsetGet() : mixed
- {@inheritdoc}
- offsetSet() : void
- {@inheritdoc}
- offsetUnset() : void
- {@inheritdoc}
- remove() : mixed
- Removes a violation at a given offset.
- set() : mixed
- Sets a violation at a given offset.
Properties
$violations
private
array<string|int, ConstraintViolationInterface>
$violations
= []
Methods
__construct()
Creates a new constraint violation list.
public
__construct([array<string|int, ConstraintViolationInterface> $violations = [] ]) : mixed
Parameters
- $violations : array<string|int, ConstraintViolationInterface> = []
-
The constraint violations to add to the list
Return values
mixed —__toString()
Converts the violation into a string for debugging purposes.
public
__toString() : string
Return values
string —The violation as string
add()
Adds a constraint violation to this list.
public
add(ConstraintViolationInterface $violation) : mixed
Parameters
- $violation : ConstraintViolationInterface
Return values
mixed —addAll()
Merges an existing violation list into this list.
public
addAll(ConstraintViolationListInterface $otherList) : mixed
Parameters
- $otherList : ConstraintViolationListInterface
Return values
mixed —count()
public
count() : int
Return values
int —findByCodes()
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
static —new instance which contains only specific errors
get()
Returns the violation at a given offset.
public
get(mixed $offset) : ConstraintViolationInterface
Parameters
- $offset : mixed
-
The offset of the violation
Return values
ConstraintViolationInterface —The violation
getIterator()
{@inheritdoc}
public
getIterator() : ArrayIterator|array<string|int, ConstraintViolationInterface>
Return values
ArrayIterator|array<string|int, ConstraintViolationInterface> —has()
Returns whether the given offset exists.
public
has(mixed $offset) : bool
Parameters
- $offset : mixed
-
The violation offset
Return values
bool —Whether the offset exists
offsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
bool —offsetGet()
{@inheritdoc}
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
Return values
mixed —offsetSet()
{@inheritdoc}
public
offsetSet(mixed $offset, mixed $violation) : void
Parameters
- $offset : mixed
- $violation : mixed
Return values
void —offsetUnset()
{@inheritdoc}
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
Return values
void —remove()
Removes a violation at a given offset.
public
remove(mixed $offset) : mixed
Parameters
- $offset : mixed
-
The offset to remove
Return values
mixed —set()
Sets a violation at a given offset.
public
set(mixed $offset, ConstraintViolationInterface $violation) : mixed
Parameters
- $offset : mixed
-
The violation offset
- $violation : ConstraintViolationInterface