File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/Symfony/Component/Form/Extension/Core/DataTransformer Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -32,9 +32,19 @@ abstract class BaseDateTimeTransformer implements DataTransformerInterface
32
32
*
33
33
* @param string $inputTimezone The name of the input timezone
34
34
* @param string $outputTimezone The name of the output timezone
35
+ *
36
+ * @throws UnexpectedTypeException if a timezone is not a string
35
37
*/
36
38
public function __construct ($ inputTimezone = null , $ outputTimezone = null )
37
39
{
40
+ if (!is_string ($ inputTimezone ) && null !== $ inputTimezone ) {
41
+ throw new UnexpectedTypeException ($ inputTimezone , 'string ' );
42
+ }
43
+
44
+ if (!is_string ($ outputTimezone ) && null !== $ outputTimezone ) {
45
+ throw new UnexpectedTypeException ($ outputTimezone , 'string ' );
46
+ }
47
+
38
48
$ this ->inputTimezone = $ inputTimezone ?: date_default_timezone_get ();
39
49
$ this ->outputTimezone = $ outputTimezone ?: date_default_timezone_get ();
40
50
}
You can’t perform that action at this time.
0 commit comments