Skip to content

Commit b137fd9

Browse files
Olivier Maisonneuvefabpot
authored andcommitted
validateOptionValues throw a notice if an allowed value is set and the corresponding option isn't.
1 parent 123587a commit b137fd9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

OptionsResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ private function validateOptionsCompleteness(array $options)
294294
private function validateOptionValues(array $options)
295295
{
296296
foreach ($this->allowedValues as $option => $allowedValues) {
297-
if (!in_array($options[$option], $allowedValues, true)) {
297+
if (isset($options[$option]) && !in_array($options[$option], $allowedValues, true)) {
298298
throw new InvalidOptionsException(sprintf('The option "%s" has the value "%s", but is expected to be one of "%s"', $option, $options[$option], implode('", "', $allowedValues)));
299299
}
300300
}

0 commit comments

Comments
 (0)