-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] improve deprecation message for "empty_value" and "choice_list" options. #17119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Form] improve deprecation message for "empty_value" and "choice_list" options. #17119
Conversation
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | ~ |
License | MIT |
Doc PR | ~ |
f0a0aff
to
71a1736
Compare
|
So |
71a1736
to
ff26475
Compare
Changed |
Does and btw, using the type name rather than the type class would be better in 2.7. People are referencing it by name, not by class in 2.7. |
That's a good point! I'm gonna try to add the type name using the |
This snippet works on PHP 5.3.29. <?php
namespace Foo\Bar;
class A
{
public function b($c)
{
$d = function () use ($c) {
return strtoupper($c).' ('.__CLASS__.')';
};
return sprintf('Hello %s!', $d());
}
}
$a = new A();
echo $a->b('Hugo'); It correctly outputs |
@@ -294,7 +294,7 @@ public function configureOptions(OptionsResolver $resolver) | |||
|
|||
$choiceListNormalizer = function (Options $options, $choiceList) use ($choiceListFactory) { | |||
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 a %s form type is deprecated since version 2.7 and will be removed in 3.0. Use "choice_loader" instead.', __CLASS__), E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to be a bit shorter : The "choice_list" option of %s is deprecated...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep! Will do it later tonight ;)
ff26475
to
72453a7
Compare
@nicolas-grekas @stof is it better now? |
8cd34fe
to
88e13a0
Compare
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we know that getName is deprecated in 2.8, shouldn't we only tell about __CLASS__
? At least that's what should be done in 2.8, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolas-grekas this PR targets Symfony 2.7. In 2.8, we should indeed change it to use the class name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it's merged, I will open the other PR against the 2.8
branch.
558293c
to
b58c0e5
Compare
…_list" options in the ChoiceType class.
b58c0e5
to
7878536
Compare
👍 |
1 similar comment
👍 8000 |
Thank you @hhamon. |
…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.