10000 bug #17119 [Form] improve deprecation message for "empty_value" and "… · symfony/symfony@3590c01 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3590c01

Browse files
bug #17119 [Form] improve deprecation message for "empty_value" and "choice_list" options. (hhamon)
This PR was merged into the 2.7 branch. Discussion ---------- [Form] improve deprecation message for "empty_value" and "choice_list" options. | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ Commits ------- 7878536 [Form] improve deprecation messages for the "empty_value" and "choice_list" options in the ChoiceType class.
2 parents a63dd19 + 7878536 commit 3590c01

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,10 @@ public function configureOptions(OptionsResolver $resolver)
292292
return;
293293
};
294294

295-
$choiceListNormalizer = function (Options $options, $choiceList) use ($choiceListFactory) {
295+
$that = $this;
296+
$choiceListNormalizer = function (Options $options, $choiceList) use ($choiceListFactory, $that) {
296297
if ($choiceList) {
297-
@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);
298+
@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);
298299

299300
if ($choiceList instanceof LegacyChoiceListInterface) {
300301
return new LegacyChoiceListAdapter($choiceList);
@@ -321,9 +322,9 @@ public function configureOptions(OptionsResolver $resolver)
321322
return $choiceListFactory->createListFromChoices($choices, $options['choice_value']);
322323
};
323324

324-
$placeholderNormalizer = function (Options $options, $placeholder) {
325+
$placeholderNormalizer = function (Options $options, $placeholder) use ($that) {
325326
if (!is_object($options['empty_value']) || !$options['empty_value'] instanceof \Exception) {
326-
@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);
327+
@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);
327328

328329
$placeholder = $options['empty_value'];
329330
}

0 commit comments

Comments
 (0)
0