OptionsResolver::addAllowedValues()

OptionsResolver addAllowedValues(string $option, mixed $allowedValues)

Adds allowed values for an option.

The values are merged with the allowed values defined previously.

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:14
Comments
Leave a Comment

Please login to continue.