Merge branch '5.1'
* 5.1: Fix wrong merge
This commit is contained in:
commit
2abc465335
@ -26,7 +26,6 @@ use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\Form\ReversedTransformer;
|
||||
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
|
||||
use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException;
|
||||
use Symfony\Component\OptionsResolver\Options;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
@ -344,23 +343,14 @@ class DateTimeType extends AbstractType
|
||||
|
||||
return $timeWidget;
|
||||
});
|
||||
foreach (['html5', 'format'] as $option) {
|
||||
$resolver->setDeprecated($option, static function (Options $options, $value) use ($option): string {
|
||||
try {
|
||||
$html5 = 'html5' === $option ? $value : $options['html5'];
|
||||
$format = 'format' === $option ? $value : $options['format'];
|
||||
} catch (OptionDefinitionException $e) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($html5 && self::HTML5_FORMAT !== $format) {
|
||||
throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is disabled.', self::class));
|
||||
$resolver->setNormalizer('html5', function (Options $options, $html5) {
|
||||
if ($html5 && self::HTML5_FORMAT !== $options['format']) {
|
||||
throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class));
|
||||
}
|
||||
|
||||
return $html5;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -23,7 +23,6 @@ use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\Form\ReversedTransformer;
|
||||
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
|
||||
use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException;
|
||||
use Symfony\Component\OptionsResolver\Options;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
@ -329,24 +328,14 @@ class DateType extends AbstractType
|
||||
$resolver->setAllowedTypes('days', 'array');
|
||||
$resolver->setAllowedTypes('input_format', 'string');
|
||||
|
||||
foreach (['html5', 'widget', 'format'] as $option) {
|
||||
$resolver->setDeprecated($option, static function (Options $options, $value) use ($option): string {
|
||||
try {
|
||||
$html5 = 'html5' === $option ? $value : $options['html5'];
|
||||
$widget = 'widget' === $option ? $value : $options['widget'];
|
||||
$format = 'format' === $option ? $value : $options['format'];
|
||||
} catch (OptionDefinitionException $e) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($html5 && 'single_text' === $widget && self::HTML5_FORMAT !== $format) {
|
||||
throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is disabled.', self::class));
|
||||
$resolver->setNormalizer('html5', function (Options $options, $html5) {
|
||||
if ($html5 && 'single_text' === $options['widget'] && self::HTML5_FORMAT !== $options['format']) {
|
||||
throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class));
|
||||
}
|
||||
|
||||
return $html5;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
Reference in New Issue
Block a user