@@ -23,20 +23,13 @@ class TimezoneType extends AbstractType
23
23
*/
24
24
private static $ timezones ;
25
25
26
- /**
27
- * Stores the available timezone choices.
28
- *
29
- * @var array
30
- */
31
- private static $ flippedTimezones ;
32
-
33
26
/**
34
27
* {@inheritdoc}
35
28
*/
36
29
public function configureOptions (OptionsResolver $ resolver )
37
30
{
38
31
$ resolver ->setDefaults (array (
39
- 'choices ' => self ::getFlippedTimezones (),
32
+ 'choices ' => self ::getTimezones (),
40
33
'choice_translation_domain ' => false ,
41
34
));
42
35
}
@@ -57,46 +50,6 @@ public function getBlockPrefix()
57
50
return 'timezone ' ;
58
51
}
59
52
60
- /**
61
- * Returns the timezone choices.
62
- *
63
- * The choices are generated from the ICU function
64
- * \DateTimeZone::listIdentifiers(). They are cached during a single request,
65
- * so multiple timezone fields on the same page don't lead to unnecessary
66
- * overhead.
67
- *
68
- * @return array The timezone choices
69
- *
70
- * @deprecated Deprecated since version 2.8
71
- */
72
- public static function getTimezones ()
73
- {
74
- @trigger_error ('The TimezoneType::getTimezones() method is deprecated since version 2.8 and will be removed in 3.0. ' , E_USER_DEPRECATED );
75
-
76
- if (null === static ::$ timezones ) {
77
- static ::$ timezones = array ();
78
-
79
- foreach (\DateTimeZone::listIdentifiers () as $ timezone ) {
80
- $ parts = explode ('/ ' , $ timezone );
81
-
82
- if (count ($ parts ) > 2 ) {
83
- $ region = $ parts [0 ];
84
- $ name = $ parts [1 ].' - ' .$ parts [2 ];
85
- } elseif (count ($ parts ) > 1 ) {
86
- $ region = $ parts [0 ];
87
- $ name = $ parts [1 ];
88
- } else {
89
- $ region = 'Other ' ;
90
- $ name = $ parts [0 ];
91
- }
92
-
93
- static ::$ timezones [$ region ][$ timezone ] = str_replace ('_ ' , ' ' , $ name );
94
- }
95
- }
96
-
97
- return static ::$ timezones ;
98
- }
99
-
100
53
/**
101
54
* Returns the timezone choices.
102
55
*
@@ -107,7 +60,7 @@ public static function getTimezones()
107
60
*
108
61
* @return array The timezone choices
109
62
*/
110
- private static function getFlippedTimezones ()
63
+ private static function getTimezones ()
111
64
{
112
65
if (null === self ::$ timezones ) {
113
66
self ::$ timezones = array ();
0 commit comments