diff --git a/src/Symfony/Component/Form/CHANGELOG.md b/src/Symfony/Component/Form/CHANGELOG.md index 850eac108c..1cd955f283 100644 --- a/src/Symfony/Component/Form/CHANGELOG.md +++ b/src/Symfony/Component/Form/CHANGELOG.md @@ -4,6 +4,8 @@ CHANGELOG 5.0.0 ----- + * Removed support for using different values for the "model_timezone" and "view_timezone" options of the `TimeType` + without configuring a reference date. * Removed the `scale` option of the `IntegerType`. * Using the `date_format`, `date_widget`, and `time_widget` options of the `DateTimeType` when the `widget` option is set to `single_text` is not supported anymore. diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php index 053f774fa8..ed683beeaf 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php @@ -13,6 +13,7 @@ namespace Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Exception\InvalidConfigurationException; +use Symfony\Component\Form\Exception\LogicException; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeImmutableToDateTimeTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer; @@ -309,12 +310,12 @@ class TimeType extends AbstractType 'choice_translation_domain' => false, ]); - $resolver->setDeprecated('model_timezone', function (Options $options, $modelTimezone): string { + $resolver->setNormalizer('model_timezone', function (Options $options, $modelTimezone): ?string { if (null !== $modelTimezone && $options['view_timezone'] !== $modelTimezone && null === $options['reference_date']) { - return sprintf('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is deprecated since Symfony 4.4.'); + throw new LogicException(sprintf('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.')); } - return ''; + return $modelTimezone; }); $resolver->setNormalizer('placeholder', $placeholderNormalizer); diff --git a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php index 0e332b70be..8d9c083fb3 100644 --- a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php +++ b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php @@ -42,11 +42,6 @@ class DebugCommandTest extends TestCase $this->assertEquals(0, $ret, 'Returns 0 in case of success'); $this->assertSame(<<