[Serializer] Remove datetime serializer#48982
[Serializer] Remove datetime serializer#48982Marion-Valls wants to merge 3 commits intosymfony:7.3from
Conversation
|
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
|
What if people uses |
| "twig/inky-extra": "^2.12|^3", | ||
| "twig/markdown-extra": "^2.12|^3" | ||
| "twig/markdown-extra": "^2.12|^3", | ||
| "vimeo/psalm": "^5.0@dev" |
There was a problem hiding this comment.
you shouldn't change composer.json, not the scope of this PR. BTW, what was your intention by adding psalm?
| private const SUPPORTED_TYPES = [ | ||
| \DateTimeInterface::class => true, | ||
| \DateTimeImmutable::class => true, | ||
| \DateTime::class => true, |
There was a problem hiding this comment.
Are you sure to drop support of normalization of \DateTime?
There was a problem hiding this comment.
This part is a no-go. We must still support normalizing DateTime objects. Otherwise, we force dropping usages of DateTime in all projects instead (and this is a BC break)
| { | ||
| $this->assertEquals(new \DateTimeImmutable('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTimeInterface::class, null, [DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|'])); | ||
| $this->assertEquals(new \DateTimeImmutable('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTimeImmutable::class, null, [DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|'])); | ||
| $this->assertEquals(new \DateTime('2016/01/01'), $this->normalizer->denormalize('2016.01.01', \DateTime::class, null, [DateTimeNormalizer::FORMAT_KEY => 'Y.m.d|'])); |
There was a problem hiding this comment.
As normalization of \DateTime should be still supported, you should restore this test.
| $this->assertEquals(new \DateTime('2016/01/01', new \DateTimeZone('UTC')), $this->normalizer->denormalize('2016-01-01T00:00:00+00:00', \DateTime::class)); | ||
| $this->assertEquals(new \DateTime('2016/01/01', new \DateTimeZone('UTC')), $this->normalizer->denormalize(' 2016-01-01T00:00:00+00:00 ', \DateTime::class)); |
There was a problem hiding this comment.
As normalization of \DateTime should be still supported, you should restore this test.
| } | ||
|
|
||
| if (null !== $dateTimeFormat) { | ||
| $object = \DateTime::class === $type ? \DateTime::createFromFormat($dateTimeFormat, $data, $timezone) : \DateTimeImmutable::createFromFormat($dateTimeFormat, $data, $timezone); |
There was a problem hiding this comment.
As $type is an argument, be careful to still support this way for users to decide of final normalization.
| private const SUPPORTED_TYPES = [ | ||
| \DateTimeInterface::class => true, | ||
| \DateTimeImmutable::class => true, | ||
| \DateTime::class => true, |
There was a problem hiding this comment.
This part is a no-go. We must still support normalizing DateTime objects. Otherwise, we force dropping usages of DateTime in all projects instead (and this is a BC break)
|
@Marion-Valls what is the state of this PR ? Will you work on fixing the feedback ? |
|
Closing as there is no more activity here. Thanks for trying |
Remove DateTime from all core bundles.