Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a2aea0

Browse files
committed
[Form] remove deprecated getTimezones() method
1 parent b5b1d50 commit 4a2aea0

File tree

1 file changed

+2
-49
lines changed

1 file changed

+2
-49
lines changed

src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,13 @@ class TimezoneType extends AbstractType
2323
*/
2424
private static $timezones;
2525

26-
/**
27-
* Stores the available timezone choices.
28-
*
29-
* @var array
30-
*/
31-
private static $flippedTimezones;
32-
3326
/**
3427
* {@inheritdoc}
3528
*/
3629
public function configureOptions(OptionsResolver $resolver)
3730
{
3831
$resolver->setDefaults(array(
39-
'choices' => self::getFlippedTimezones(),
32+
'choices' => self::getTimezones(),
4033
'choice_translation_domain' => false,
4134
));
4235
}
@@ -57,46 +50,6 @@ public function getBlockPrefix()
5750
return 'timezone';
5851
}
5952

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-
10053
/**
10154
* Returns the timezone choices.
10255
*
@@ -107,7 +60,7 @@ public static function getTimezones()
10760
*
10861
* @return array The timezone choices
10962
*/
110-
private static function getFlippedTimezones()
63+
private static function getTimezones()
11164
{
11265
if (null === self::$timezones) {
11366
self::$timezones = array();

0 commit comments

Comments
 (0)