Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3dc6033

Browse files
committed
drop support for differing timezones without ref date
1 parent 85016e8 commit 3dc6033

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

src/Symfony/Component/Form/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ CHANGELOG
44
5.0.0
55
-----
66

7+
* Removed support for using different values for the "model_timezone" and "view_timezone" options of the `TimeType`
8+
without configuring a reference date.
79
* Removed the `scale` option of the `IntegerType`.
810
* Using the `date_format`, `date_widget`, and `time_widget` options of the `DateTimeType` when the `widget` option is
911
set to `single_text` is not supported anymore.

src/Symfony/Component/Form/Extension/Core/Type/TimeType.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Form\AbstractType;
1515
use Symfony\Component\Form\Exception\InvalidConfigurationException;
16+
use Symfony\Component\Form\Exception\LogicException;
1617
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeImmutableToDateTimeTransformer;
1718
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
1819
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
@@ -309,12 +310,12 @@ public function configureOptions(OptionsResolver $resolver)
309310
'choice_translation_domain' => false,
310311
]);
311312

312-
$resolver->setDeprecated('model_timezone', function (Options $options, $modelTimezone): string {
313+
$resolver->setNormalizer('model_timezone', function (Options $options, $modelTimezone): ?string {
313314
if (null !== $modelTimezone && $options['view_timezone'] !== $modelTimezone && null === $options['reference_date']) {
314-
return sprintf('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is deprecated since Symfony 4.4.');
315+
throw new LogicException(sprintf('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.'));
315316
}
316317

317-
return '';
318+
return $modelTimezone;
318319
});
319320

320321
$resolver->setNormalizer('placeholder', $placeholderNormalizer);

src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ public function testDebugDeprecatedDefaults()
4242
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
4343
$this->assertSame(<<<TXT
4444
45-
Built-in form types (Symfony\Component\Form\Extension\Core\Type)
46-
----------------------------------------------------------------
47-
48-
TimeType
49-
5045
Service form types
5146
------------------
5247

src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ public function testSetDataDifferentTimezonesDuringDaylightSavingTime()
426426
}
427427

428428
/**
429-
* @group legacy
430-
* @expectedDeprecation Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is deprecated since Symfony 4.4.
429+
* @expectedException \Symfony\Component\Form\Exception\LogicException
430+
* @expectedExceptionMessage Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.
431431
*/
432432
public function testSetDataDifferentTimezonesWithoutReferenceDate()
433433
{

0 commit comments

Comments
 (0)