OptionsResolver::setAllowedValues()

OptionsResolver setAllowedValues(string $option, mixed $allowedValues)

Sets allowed values for an option.

Instead of passing values, you may also pass a closures with the following signature:

function ($value) {
    // return true or false
}

The closure receives the value as argument and should return true to accept the value and false to reject the value.

Parameters

string $option The option name
mixed $allowedValues One or more acceptable values/closures

Return Value

OptionsResolver This instance

Exceptions

UndefinedOptionsException If the option is undefined
AccessException If called from a lazy option or normalizer
doc_Symfony
2016-10-28 06:25:17
Comments
Leave a Comment

Please login to continue.