@@ -418,7 +418,18 @@ public function setNormalizer($option, \Closure $normalizer)
418
418
}
419
419
420
420
/**
421
- * {@inheritdoc}
421
+ * Sets the normalizers for an array of options.
422
+ *
423
+ * @param array $normalizers An array of closures
424
+ *
425
+ * @return OptionsResolver This instance
426
+ *
427
+ * @throws UndefinedOptionsException If the option is undefined
428
+ * @throws AccessException If called from a lazy option or normalizer
429
+ *
430
+ * @see setNormalizer()
431
+ *
432
+ * @deprecated since version 2.6, to be removed in 3.0.
422
433
*/
423
434
public function setNormalizers (array $ normalizers )
424
435
{
@@ -473,7 +484,7 @@ public function setAllowedValues($option, $allowedValues = null)
473
484
));
474
485
}
475
486
476
- $ this ->allowedValues [$ option ] = $ allowedValues instanceof \Closure ? array ( $ allowedValues) : ( array ) $ allowedValues ;
487
+ $ this ->allowedValues [$ option ] = is_array ( $ allowedValues) ? $ allowedValues : array ( $ allowedValues) ;
477
488
478
489
// Make sure the option is processed
479
490
unset($ this ->resolved [$ option ]);
@@ -527,12 +538,14 @@ public function addAllowedValues($option, $allowedValues = null)
527
538
));
528
539
}
529
540
530
- if ($ allowedValues instanceof \Closure) {
531
- $ this ->allowedValues [$ option ][] = $ allowedValues ;
532
- } elseif (!isset ($ this ->allowedValues [$ option ])) {
533
- $ this ->allowedValues [$ option ] = (array ) $ allowedValues ;
541
+ if (!is_array ($ allowedValues )) {
542
+ $ allowedValues = array ($ allowedValues );
543
+ }
544
+
545
+ if (!isset ($ this ->allowedValues [$ option ])) {
546
+ $ this ->allowedValues [$ option ] = $ allowedValues ;
534
547
} else {
535
- $ this ->allowedValues [$ option ] = array_merge ($ this ->allowedValues [$ option ], ( array ) $ allowedValues );
548
+ $ this ->allowedValues [$ option ] = array_merge ($ this ->allowedValues [$ option ], $ allowedValues );
536
549
}
537
550
538
551
// Make sure the option is processed
0 commit comments