@@ -90,7 +90,7 @@ public function __construct($inputTimezone = null, $outputTimezone = null, $form
9090 * Transforms a DateTime object into a date string with the configured format
9191 * and timezone.
9292 *
93- * @param \DateTime|\DateTimeInterface $dateTime A DateTime object
93+ * @param \DateTime|\DateTimeInterface $value A DateTime object
9494 *
9595 * @return string A value as produced by PHP's date() function
9696 *
@@ -142,21 +142,21 @@ public function reverseTransform($value)
142142 throw new TransformationFailedException ('Expected a string. ' );
143143 }
144144
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 );
148147
149- $ lastErrors = \DateTime::getLastErrors ();
148+ $ lastErrors = \DateTime::getLastErrors ();
150149
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+ }
159158
159+ try {
160160 // On PHP versions < 5.3.7 we need to emulate the pipe operator
161161 // and reset parts not given in the format to their equivalent
162162 // of the UNIX base timestamp.
@@ -224,8 +224,6 @@ public function reverseTransform($value)
224224 if ($ this ->inputTimezone !== $ this ->outputTimezone ) {
225225 $ dateTime ->setTimezone (new \DateTimeZone ($ this ->inputTimezone ));
226226 }
227- } catch (TransformationFailedException $ e ) {
228- throw $ e ;
229227 } catch (\Exception $ e ) {
230228 throw new TransformationFailedException ($ e ->getMessage (), $ e ->getCode (), $ e );
231229 }
0 commit comments