|
23 | 23 | use Symfony\Component\Form\FormView;
|
24 | 24 | use Symfony\Component\Form\ReversedTransformer;
|
25 | 25 | use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
|
26 |
| -use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; |
27 | 26 | use Symfony\Component\OptionsResolver\Options;
|
28 | 27 | use Symfony\Component\OptionsResolver\OptionsResolver;
|
29 | 28 |
|
@@ -329,23 +328,13 @@ public function configureOptions(OptionsResolver $resolver)
|
329 | 328 | $resolver->setAllowedTypes('days', 'array');
|
330 | 329 | $resolver->setAllowedTypes('input_format', 'string');
|
331 | 330 |
|
332 |
| - foreach (['html5', 'widget', 'format'] as $option) { |
333 |
| - $resolver->setDeprecated($option, static function (Options $options, $value) use ($option): string { |
334 |
| - try { |
335 |
| - $html5 = 'html5' === $option ? $value : $options['html5']; |
336 |
| - $widget = 'widget' === $option ? $value : $options['widget']; |
337 |
| - $format = 'format' === $option ? $value : $options['format']; |
338 |
| - } catch (OptionDefinitionException $e) { |
339 |
| - return ''; |
340 |
| - } |
341 |
| - |
342 |
| - if ($html5 && 'single_text' === $widget && self::HTML5_FORMAT !== $format) { |
343 |
| - throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is disabled.', self::class)); |
344 |
| - } |
| 331 | + $resolver->setNormalizer('html5', function (Options $options, $html5) { |
| 332 | + if ($html5 && 'single_text' === $options['widget'] && self::HTML5_FORMAT !== $options['format']) { |
| 333 | + throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class)); |
| 334 | + } |
345 | 335 |
|
346 |
| - return $html5; |
347 |
| - }); |
348 |
| - } |
| 336 | + return $html5; |
| 337 | + }); |
349 | 338 | }
|
350 | 339 |
|
351 | 340 | /**
|
|
0 commit comments