ObjectValidatorInterface extends ValidatorInterface

Contract for a validator

Table of Contents

Methods

getOptions()  : array<string|int, mixed>
Returns the options of this validator which can be specified in the constructor
setValidatedInstancesContainer()  : mixed
Allows to set a container to keep track of validated instances.
validate()  : Result
Checks if the given value is valid according to the validator, and returns the Error Messages object which occurred.

Methods

getOptions()

Returns the options of this validator which can be specified in the constructor

public getOptions() : array<string|int, mixed>
Tags
todo:

Return type 'array' will be added in v12. Extensions should add this for v11 & v12 compatible extensions if they override getOptions(). AbstractValidator will add 'Result' return in v12.

Return values
array<string|int, mixed>

setValidatedInstancesContainer()

Allows to set a container to keep track of validated instances.

public setValidatedInstancesContainer(SplObjectStorage $validatedInstancesContainer) : mixed
Parameters
$validatedInstancesContainer : SplObjectStorage

A container to keep track of validated instances

validate()

Checks if the given value is valid according to the validator, and returns the Error Messages object which occurred.

public validate(mixed $value) : Result
Parameters
$value : mixed

The value that should be validated

Tags
todo:

Return type 'Result' will be added in v12. Extensions should add this for v11 & v12 compatible extensions if they override validate(). AbstractValidator will add 'Result' return in v12.

todo:

Argument signature will be 'mixed $value' in v12, but AbstractValidator adds this starting with v13 only to simplify compat for extensions supporting v11 & v12 and thus PHP < 8.1.

Return values
Result

        
On this page

Search results