@@ -424,7 +424,18 @@ public function setNormalizer($option, \Closure $normalizer)
424
424
}
425
425
426
426
/**
427
- * {@inheritdoc}
427
+ * Sets the normalizers for an array of options.
428
+ *
429
+ * @param array $normalizers An array of closures
430
+ *
431
+ * @return OptionsResolver This instance
432
+ *
433
+ * @throws UndefinedOptionsException If the option is undefined
434
+ * @throws AccessException If called from a lazy option or normalizer
435
+ *
436
+ * @see setNormalizer()
437
+ *
438
+ * @deprecated since version 2.6, to be removed in 3.0.
428
439
*/
429
440
public function setNormalizers (array $ normalizers )
430
441
{
@@ -483,7 +494,7 @@ public function setAllowedValues($option, $allowedValues = null)
483
494
));
484
495
}
485
496
486
- $ this ->allowedValues [$ option ] = $ allowedValues instanceof \Closure ? array ( $ allowedValues) : ( array ) $ allowedValues ;
497
+ $ this ->allowedValues [$ option ] = is_array ( $ allowedValues) ? $ allowedValues : array ( $ allowedValues) ;
487
498
488
499
// Make sure the option is processed
489
500
unset($ this ->resolved [$ option ]);
@@ -539,12 +550,14 @@ public function addAllowedValues($option, $allowedValues = null)
539
550
));
540
551
}
541
552
542
- if ($ allowedValues instanceof \Closure) {
543
- $ this ->allowedValues [$ option ][] = $ allowedValues ;
544
- } elseif (!isset ($ this ->allowedValues [$ option ])) {
545
- $ this ->allowedValues [$ option ] = (array ) $ allowedValues ;
553
+ if (!is_array ($ allowedValues )) {
554
+ $ allowedValues = array ($ allowedValues );
555
+ }
556
+
557
+ if (!isset ($ this ->allowedValues [$ option ])) {
558
+ $ this ->allowedValues [$ option ] = $ allowedValues ;
546
559
} else {
547
- $ this ->allowedValues [$ option ] = array_merge ($ this ->allowedValues [$ option ], ( array ) $ allowedValues );
560
+ $ this ->allowedValues [$ option ] = array_merge ($ this ->allowedValues [$ option ], $ allowedValues );
548
561
}
549
562
550
563
// Make sure the option is processed
0 commit comments