You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* allow multiple datetime deserialization formats
* DateTimeOptions: allow both string and array<string> for DateTimeOptions::$deserializeFormats, until v2.x
---------
Co-authored-by: David Buchmann <david@liip.ch>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,11 @@
2
2
3
3
# Version 1.x
4
4
5
-
# 1.3.0 (unreleased)
5
+
# 1.2.0 (unreleased)
6
+
7
+
* DateTimeOptions now features a list of deserialization formats instead of a single string one. Passing a string instead of an array to its `__construct`or is deprecated, and will be forbidden in the next version
8
+
Similarly, `getDeserializeFormat(): ?string` is deprecated in favor of `getDeserializeFormats(): ?array`
9
+
6
10
7
11
* Added `PropertyTypeIterable`, which generalizes `PropertyTypeArray` to allow merging Collection informations like one would with arrays, including between interfaces and concrete classes
8
12
* Deprecated `PropertyTypeArray`, please prefer using `PropertyTypeIterable` instead
// {@link \JMS\Serializer\Handler\DateHandler} of jms/serializer defaults to using the serialization format as a deserialization format if none was supplied...
// Jms defaults to DateTime when given DateTimeInterface despite the documentation saying DateTimeImmutable, {@see \JMS\Serializer\Handler\DateHandler} in jms/serializer
Copy file name to clipboardExpand all lines: tests/TypeParser/JMSTypeParserTest.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -122,7 +122,7 @@ public function provideDateTimeTypeCases(): iterable
122
122
'DateTime|null',
123
123
'Y-m-d H:i:s',
124
124
null,
125
-
null,
125
+
'Y-m-d H:i:s',
126
126
];
127
127
128
128
yield [
@@ -162,7 +162,7 @@ public function provideDateTimeTypeCases(): iterable
162
162
'DateTimeImmutable|null',
163
163
'Y-m-d H:i:s',
164
164
null,
165
-
null,
165
+
'Y-m-d H:i:s',
166
166
];
167
167
168
168
yield [
@@ -202,6 +202,7 @@ public function testDateTimeType(string $rawType, string $expectedType, ?string
202
202
$this->assertSame($expectedFormat, $type->getFormat(), 'Date time format should match');
203
203
$this->assertSame($expectedZone, $type->getZone(), 'Date time zone should match');
204
204
$this->assertSame($expectedDeserializeFormat, $type->getDeserializeFormat(), 'Date time deserialize format should match');
205
+
$this->assertSame($expectedDeserializeFormat ? [$expectedDeserializeFormat] : null, $type->getDeserializeFormats(), 'Date time deserialize format should match');
0 commit comments