From 787853673bc12d0d147c0968ebc5a633880514bf Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Wed, 23 Dec 2015 11:40:24 +0100 Subject: [PATCH] [Form] improve deprecation messages for the "empty_value" and "choice_list" options in the ChoiceType class. --- .../Component/Form/Extension/Core/Type/ChoiceType.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php index 1465551b906a6..ced8fc3f43727 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php @@ -292,9 +292,10 @@ public function configureOptions(OptionsResolver $resolver) return; }; - $choiceListNormalizer = function (Options $options, $choiceList) use ($choiceListFactory) { + $that = $this; + $choiceListNormalizer = function (Options $options, $choiceList) use ($choiceListFactory, $that) { if ($choiceList) { - @trigger_error('The "choice_list" option is deprecated since version 2.7 and will be removed in 3.0. Use "choice_loader" instead.', E_USER_DEPRECATED); + @trigger_error(sprintf('The "choice_list" option of the "%s" form type (%s) is deprecated since version 2.7 and will be removed in 3.0. Use "choice_loader" instead.', $that->getName(), __CLASS__), E_USER_DEPRECATED); if ($choiceList instanceof LegacyChoiceListInterface) { return new LegacyChoiceListAdapter($choiceList); @@ -321,9 +322,9 @@ public function configureOptions(OptionsResolver $resolver) return $choiceListFactory->createListFromChoices($choices, $options['choice_value']); }; - $placeholderNormalizer = function (Options $options, $placeholder) { + $placeholderNormalizer = function (Options $options, $placeholder) use ($that) { if (!is_object($options['empty_value']) || !$options['empty_value'] instanceof \Exception) { - @trigger_error('The form option "empty_value" is deprecated since version 2.6 and will be removed in 3.0. Use "placeholder" instead.', E_USER_DEPRECATED); + @trigger_error(sprintf('The form option "empty_value" of the "%s" form type (%s) is deprecated since version 2.6 and will be removed in 3.0. Use "placeholder" instead.', $that->getName(), __CLASS__), E_USER_DEPRECATED); $placeholder = $options['empty_value']; } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy