@@ -424,7 +424,18 @@ public function setNormalizer($option, \Closure $normalizer)
424424 }
425425
426426 /**
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.
428439 */
429440 public function setNormalizers (array $ normalizers )
430441 {
@@ -483,7 +494,7 @@ public function setAllowedValues($option, $allowedValues = null)
483494 ));
484495 }
485496
486- $ this ->allowedValues [$ option ] = $ allowedValues instanceof \Closure ? array ( $ allowedValues) : ( array ) $ allowedValues ;
497+ $ this ->allowedValues [$ option ] = is_array ( $ allowedValues) ? $ allowedValues : array ( $ allowedValues) ;
487498
488499 // Make sure the option is processed
489500 unset($ this ->resolved [$ option ]);
@@ -539,12 +550,14 @@ public function addAllowedValues($option, $allowedValues = null)
539550 ));
540551 }
541552
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 ;
546559 } else {
547- $ this ->allowedValues [$ option ] = array_merge ($ this ->allowedValues [$ option ], ( array ) $ allowedValues );
560+ $ this ->allowedValues [$ option ] = array_merge ($ this ->allowedValues [$ option ], $ allowedValues );
548561 }
549562
550563 // Make sure the option is processed
0 commit comments