minor #32759 [Form] drop support for differing timezones without ref date (xabbuh)

This PR was merged into the 5.0-dev branch.

Discussion
----------

[Form] drop support for differing timezones without ref date

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

3dc6033f8b drop support for differing timezones without ref date
This commit is contained in:
Christian Flothmann 2019-07-30 10:26:24 +02:00
commit 1f8f4f2011
4 changed files with 8 additions and 10 deletions

View File

@ -4,6 +4,8 @@ CHANGELOG
5.0.0 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`. * 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 * 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. set to `single_text` is not supported anymore.

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Exception\InvalidConfigurationException; 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\DateTimeImmutableToDateTimeTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
@ -309,12 +310,12 @@ class TimeType extends AbstractType
'choice_translation_domain' => false, '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']) { 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); $resolver->setNormalizer('placeholder', $placeholderNormalizer);

View File

@ -42,11 +42,6 @@ class DebugCommandTest extends TestCase
$this->assertEquals(0, $ret, 'Returns 0 in case of success'); $this->assertEquals(0, $ret, 'Returns 0 in case of success');
$this->assertSame(<<<TXT $this->assertSame(<<<TXT
Built-in form types (Symfony\Component\Form\Extension\Core\Type)
----------------------------------------------------------------
TimeType
Service form types Service form types
------------------ ------------------

View File

@ -426,8 +426,8 @@ class TimeTypeTest extends BaseTypeTest
} }
/** /**
* @group legacy * @expectedException \Symfony\Component\Form\Exception\LogicException
* @expectedDeprecation Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is deprecated since Symfony 4.4. * @expectedExceptionMessage Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.
*/ */
public function testSetDataDifferentTimezonesWithoutReferenceDate() public function testSetDataDifferentTimezonesWithoutReferenceDate()
{ {