[Form] Remove deprecated ChoiceLoaderInterface implementation in TimezoneType

This commit is contained in:
Maxime Steinhausser 2017-09-17 20:01:07 +02:00
parent 14005260be
commit 47993a8abd
2 changed files with 2 additions and 76 deletions

View File

@ -18,6 +18,7 @@ CHANGELOG
* removed passing a `ValueExporter` instance to the `FormDataExtractor::__construct()` method * removed passing a `ValueExporter` instance to the `FormDataExtractor::__construct()` method
* removed passing guesser services ids as the fourth argument of `DependencyInjectionExtension::__construct()` * removed passing guesser services ids as the fourth argument of `DependencyInjectionExtension::__construct()`
* removed the ability to validate an unsubmitted form. * removed the ability to validate an unsubmitted form.
* removed `ChoiceLoaderInterface` implementation in `TimezoneType`
3.4.0 3.4.0
----- -----

View File

@ -12,27 +12,14 @@
namespace Symfony\Component\Form\Extension\Core\Type; namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader; use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeZoneToStringTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeZoneToStringTransformer;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
class TimezoneType extends AbstractType implements ChoiceLoaderInterface class TimezoneType extends AbstractType
{ {
/**
* Timezone loaded choice list.
*
* The choices are generated from the ICU function \DateTimeZone::listIdentifiers().
*
* @var ArrayChoiceList
*
* @deprecated since version 3.4, to be removed in 4.0
*/
private $choiceList;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -82,68 +69,6 @@ class TimezoneType extends AbstractType implements ChoiceLoaderInterface
return 'timezone'; return 'timezone';
} }
/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
public function loadChoiceList($value = null)
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
if (null !== $this->choiceList) {
return $this->choiceList;
}
return $this->choiceList = new ArrayChoiceList(self::getTimezones(\DateTimeZone::ALL), $value);
}
/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
public function loadChoicesForValues(array $values, $value = null)
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
// Optimize
$values = array_filter($values);
if (empty($values)) {
return array();
}
// If no callable is set, values are the same as choices
if (null === $value) {
return $values;
}
return $this->loadChoiceList($value)->getChoicesForValues($values);
}
/**
* {@inheritdoc}
*
* @deprecated since version 3.4, to be removed in 4.0
*/
public function loadValuesForChoices(array $choices, $value = null)
{
@trigger_error(sprintf('Method "%s" is deprecated since version 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
// Optimize
$choices = array_filter($choices);
if (empty($choices)) {
return array();
}
// If no callable is set, choices are the same as values
if (null === $value) {
return $choices;
}
return $this->loadChoiceList($value)->getValuesForChoices($choices);
}
/** /**
* Returns a normalized array of timezone choices. * Returns a normalized array of timezone choices.
* *