@@ -90,7 +90,7 @@ public function __construct($inputTimezone = null, $outputTimezone = null, $form
90
90
* Transforms a DateTime object into a date string with the configured format
91
91
* and timezone.
92
92
*
93
- * @param \DateTime|\DateTimeInterface $dateTime A DateTime object
93
+ * @param \DateTime|\DateTimeInterface $value A DateTime object
94
94
*
95
95
* @return string A value as produced by PHP's date() function
96
96
*
@@ -142,21 +142,21 @@ public function reverseTransform($value)
142
142
throw new TransformationFailedException ('Expected a string. ' );
143
143
}
144
144
145
- try {
146
- $ outputTz = new \DateTimeZone ($ this ->outputTimezone );
147
- $ dateTime = \DateTime::createFromFormat ($ this ->parseFormat , $ value , $ outputTz );
145
+ $ outputTz = new \DateTimeZone ($ this ->outputTimezone );
146
+ $ dateTime = \DateTime::createFromFormat ($ this ->parseFormat , $ value , $ outputTz );
148
147
149
- $ lastErrors = \DateTime::getLastErrors ();
148
+ $ lastErrors = \DateTime::getLastErrors ();
150
149
151
- if (0 < $ lastErrors ['warning_count ' ] || 0 < $ lastErrors ['error_count ' ]) {
152
- throw new TransformationFailedException (
153
- implode (', ' , array_merge (
154
- array_values ($ lastErrors ['warnings ' ]),
155
- array_values ($ lastErrors ['errors ' ])
156
- ))
157
- );
158
- }
150
+ if (0 < $ lastErrors ['warning_count ' ] || 0 < $ lastErrors ['error_count ' ]) {
151
+ throw new TransformationFailedException (
152
+ implode (', ' , array_merge (
153
+ array_values ($ lastErrors ['warnings ' ]),
154
+ array_values ($ lastErrors ['errors ' ])
155
+ ))
156
+ );
157
+ }
159
158
159
+ try {
160
160
// On PHP versions < 5.3.7 we need to emulate the pipe operator
161
161
// and reset parts not given in the format to their equivalent
162
162
// of the UNIX base timestamp.
@@ -224,8 +224,6 @@ public function reverseTransform($value)
224
224
if ($ this ->inputTimezone !== $ this ->outputTimezone ) {
225
225
$ dateTime ->setTimezone (new \DateTimeZone ($ this ->inputTimezone ));
226
226
}
227
- } catch (TransformationFailedException $ e ) {
228
- throw $ e ;
229
227
} catch (\Exception $ e ) {
230
228
throw new TransformationFailedException ($ e ->getMessage (), $ e ->getCode (), $ e );
231
229
}
0 commit comments