diff --git a/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php b/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php index e15cd01c22181..4072117a29a9c 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php @@ -12,28 +12,13 @@ namespace Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\ChoiceList\ArrayChoiceList; -use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; use Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader; use Symfony\Component\Intl\Countries; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; -class CountryType extends AbstractType implements ChoiceLoaderInterface +class CountryType extends AbstractType { - /** - * Country loaded choice list. - * - * The choices are lazy loaded and generated from the Intl component. - * - * {@link \Symfony\Component\Intl\Intl::getRegionBundle()}. - * - * @var ArrayChoiceList - * - * @deprecated since Symfony 4.1 - */ - private $choiceList; - /** * {@inheritdoc} */ @@ -69,61 +54,4 @@ public function getBlockPrefix() { return 'country'; } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadChoiceList($value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - if (null !== $this->choiceList) { - return $this->choiceList; - } - - return $this->choiceList = new ArrayChoiceList(array_flip(Countries::getNames()), $value); - } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadChoicesForValues(array $values, $value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - // Optimize - $values = array_filter($values); - if (empty($values)) { - return []; - } - - return $this->loadChoiceList($value)->getChoicesForValues($values); - } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadValuesForChoices(array $choices, $value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - // Optimize - $choices = array_filter($choices); - if (empty($choices)) { - return []; - } - - // If no callable is set, choices are the same as values - if (null === $value) { - return $choices; - } - - return $this->loadChoiceList($value)->getValuesForChoices($choices); - } } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php b/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php index 486bdc7b20206..671991452ce4e 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php @@ -12,28 +12,13 @@ namespace Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\ChoiceList\ArrayChoiceList; -use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; use Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader; use Symfony\Component\Intl\Currencies; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; -class CurrencyType extends AbstractType implements ChoiceLoaderInterface +class CurrencyType extends AbstractType { - /** - * Currency loaded choice list. - * - * The choices are lazy loaded and generated from the Intl component. - * - * {@link \Symfony\Component\Intl\Intl::getCurrencyBundle()}. - * - * @var ArrayChoiceList - * - * @deprecated since Symfony 4.1 - */ - private $choiceList; - /** * {@inheritdoc} */ @@ -69,61 +54,4 @@ public function getBlockPrefix() { return 'currency'; } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadChoiceList($value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - if (null !== $this->choiceList) { - return $this->choiceList; - } - - return $this->choiceList = new ArrayChoiceList(array_flip(Currencies::getNames()), $value); - } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadChoicesForValues(array $values, $value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - // Optimize - $values = array_filter($values); - if (empty($values)) { - return []; - } - - return $this->loadChoiceList($value)->getChoicesForValues($values); - } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadValuesForChoices(array $choices, $value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - // Optimize - $choices = array_filter($choices); - if (empty($choices)) { - return []; - } - - // If no callable is set, choices are the same as values - if (null === $value) { - return $choices; - } - - return $this->loadChoiceList($value)->getValuesForChoices($choices); - } } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php b/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php index 4a0cbe1f8f459..dc8d43b0b1bad 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php @@ -12,28 +12,13 @@ namespace Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\ChoiceList\ArrayChoiceList; -use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; use Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader; use Symfony\Component\Intl\Languages; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; -class LanguageType extends AbstractType implements ChoiceLoaderInterface +class LanguageType extends AbstractType { - /** - * Language loaded choice list. - * - * The choices are lazy loaded and generated from the Intl component. - * - * {@link \Symfony\Component\Intl\Intl::getLanguageBundle()}. - * - * @var ArrayChoiceList - * - * @deprecated since Symfony 4.1 - */ - private $choiceList; - /** * {@inheritdoc} */ @@ -69,61 +54,4 @@ public function getBlockPrefix() { return 'language'; } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadChoiceList($value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - if (null !== $this->choiceList) { - return $this->choiceList; - } - - return $this->choiceList = new ArrayChoiceList(array_flip(Languages::getNames()), $value); - } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadChoicesForValues(array $values, $value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - // Optimize - $values = array_filter($values); - if (empty($values)) { - return []; - } - - return $this->loadChoiceList($value)->getChoicesForValues($values); - } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadValuesForChoices(array $choices, $value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - // Optimize - $choices = array_filter($choices); - if (empty($choices)) { - return []; - } - - // If no callable is set, choices are the same as values - if (null === $value) { - return $choices; - } - - return $this->loadChoiceList($value)->getValuesForChoices($choices); - } } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php b/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php index 41e016df1008b..b0a60161a40d9 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php @@ -12,28 +12,13 @@ namespace Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\ChoiceList\ArrayChoiceList; -use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; use Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader; use Symfony\Component\Intl\Locales; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; -class LocaleType extends AbstractType implements ChoiceLoaderInterface +class LocaleType extends AbstractType { - /** - * Locale loaded choice list. - * - * The choices are lazy loaded and generated from the Intl component. - * - * {@link \Symfony\Component\Intl\Intl::getLocaleBundle()}. - * - * @var ArrayChoiceList - * - * @deprecated since Symfony 4.1 - */ - private $choiceList; - /** * {@inheritdoc} */ @@ -69,61 +54,4 @@ public function getBlockPrefix() { return 'locale'; } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadChoiceList($value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - if (null !== $this->choiceList) { - return $this->choiceList; - } - - return $this->choiceList = new ArrayChoiceList(array_flip(Locales::getNames()), $value); - } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadChoicesForValues(array $values, $value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - // Optimize - $values = array_filter($values); - if (empty($values)) { - return []; - } - - return $this->loadChoiceList($value)->getChoicesForValues($values); - } - - /** - * {@inheritdoc} - * - * @deprecated since Symfony 4.1 - */ - public function loadValuesForChoices(array $choices, $value = null) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); - - // Optimize - $choices = array_filter($choices); - if (empty($choices)) { - return []; - } - - // If no callable is set, choices are the same as values - if (null === $value) { - return $choices; - } - - return $this->loadChoiceList($value)->getValuesForChoices($choices); - } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php index 8c72b46bbcd2e..388fd142aa085 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\ChoiceList\View\ChoiceView; -use Symfony\Component\Form\Extension\Core\Type\CountryType; use Symfony\Component\Intl\Util\IntlTestHelper; class CountryTypeTest extends BaseTypeTest @@ -81,14 +80,4 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'FR', $expectedD { parent::testSubmitNullUsesDefaultEmptyData($emptyData, $expectedData); } - - /** - * @group legacy - */ - public function testInvalidChoiceValuesAreDropped() - { - $type = new CountryType(); - - $this->assertSame([], $type->loadChoicesForValues(['foo'])); - } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php index a02bae031add8..2cdcd03c6baf6 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\ChoiceList\View\ChoiceView; -use Symfony\Component\Form\Extension\Core\Type\CurrencyType; use Symfony\Component\Intl\Util\IntlTestHelper; class CurrencyTypeTest extends BaseTypeTest @@ -62,14 +61,4 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'EUR', $expected { parent::testSubmitNullUsesDefaultEmptyData($emptyData, $expectedData); } - - /** - * @group legacy - */ - public function testInvalidChoiceValuesAreDropped() - { - $type = new CurrencyType(); - - $this->assertSame([], $type->loadChoicesForValues(['foo'])); - } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php index 7f25c8dab7772..618cf3b16ab95 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\ChoiceList\View\ChoiceView; -use Symfony\Component\Form\Extension\Core\Type\LanguageType; use Symfony\Component\Intl\Util\IntlTestHelper; class LanguageTypeTest extends BaseTypeTest @@ -73,14 +72,4 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'en', $expectedD { parent::testSubmitNullUsesDefaultEmptyData($emptyData, $expectedData); } - - /** - * @group legacy - */ - public function testInvalidChoiceValuesAreDropped() - { - $type = new LanguageType(); - - $this->assertSame([], $type->loadChoicesForValues(['foo'])); - } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php index 484d9cede822b..866362bdc1348 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\ChoiceList\View\ChoiceView; -use Symfony\Component\Form\Extension\Core\Type\LocaleType; use Symfony\Component\Intl\Util\IntlTestHelper; class LocaleTypeTest extends BaseTypeTest @@ -62,14 +61,4 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'en', $expectedD { parent::testSubmitNullUsesDefaultEmptyData($emptyData, $expectedData); } - - /** - * @group legacy - */ - public function testInvalidChoiceValuesAreDropped() - { - $type = new LocaleType(); - - $this->assertSame([], $type->loadChoicesForValues(['foo'])); - } }