@@ -41,8 +41,8 @@ public function map(array $data): mixed
41
41
'OffsetDateTime ' => $ this ->mapDateTime ($ data ['_value ' ]),
42
42
'Time ' => $ this ->mapTime ($ data ['_value ' ]),
43
43
'LocalTime ' => $ this ->mapLocalTime ($ data ['_value ' ]),
44
- 'LocalDateTime ' => $ this ->mapLocalDateTime ($ data ['_value ' ]),
45
- 'Duration ' => $ this ->mapDuration ($ data ['_value ' ]),
44
+ 'LocalDateTime ' => $ this ->mapLocalDateTime ($ data ['_value ' ]),
45
+ 'Duration ' => $ this ->mapDuration ($ data ['_value ' ]),
46
46
47
47
'String ' => $ this ->isValidTimeZone ($ data ['_value ' ])
48
48
? new DateTimeZoneId ($ data ['_value ' ]) // Convert timezone strings to `DateTimeZoneId`
@@ -147,19 +147,19 @@ private function mapProperties(array $properties): array
147
147
return $ mappedProperties ;
148
148
}
149
149
150
- private function mapDate (string $ value )
150
+ private function mapDate (string $ value ): Date
151
151
{
152
152
$ totalDaysSinceEpoch = (new \DateTime ($ value ))->diff (new \DateTime ('@0 ' ))->days ;
153
153
154
154
return new Date ($ totalDaysSinceEpoch );
155
155
}
156
156
157
- private function mapDateTime (string $ value )
157
+ private function mapDateTime (string $ value ): DateTime
158
158
{
159
159
return new DateTime ($ value );
160
160
}
161
161
162
- private function mapDateTimeZoneId (string $ value )
162
+ private function mapDateTimeZoneId (string $ value ): DateTimeZoneId
163
163
{
164
164
return new DateTimeZoneId ($ value );
165
165
}
@@ -169,24 +169,24 @@ private function isValidTimeZone(string $value): bool
169
169
return in_array ($ value , timezone_identifiers_list (), true );
170
170
}
171
171
172
- private function mapTime (mixed $ _value )
172
+ private function mapTime (mixed $ _value ): Time
173
173
{
174
174
return new Time ($ _value );
175
175
176
176
}
177
177
178
- private function mapLocalTime (mixed $ _value )
178
+ private function mapLocalTime (mixed $ _value ): LocalTime
179
179
{
180
180
return new LocalTime ($ _value );
181
181
}
182
182
183
- private function mapLocalDateTime (mixed $ _value )
183
+ private function mapLocalDateTime (mixed $ _value ): LocalDateTime
184
184
{
185
- return new LocalDateTime ($ _value );
185
+ return new LocalDateTime ($ _value );
186
186
}
187
187
188
- private function mapDuration (mixed $ _value )
188
+ private function mapDuration (mixed $ _value ): Duration
189
189
{
190
- return new Duration ($ _value );
190
+ return new Duration ($ _value );
191
191
}
192
192
}
0 commit comments