-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Deprecated precision option in favor of scale #13717
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
Conversation
@@ -93,13 +93,13 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface | |||
*/ | |||
const ROUND_HALFDOWN = \NumberFormatter::ROUND_HALFDOWN; | |||
|
|||
protected $precision; | |||
protected $scale; |
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.
renaming a protected property is a BC break (we should probably switch it to private in 3.0 btw)
Thanks @stof. I've applied some fixes to this PR. |
failures look unrelated |
👍 |
@@ -93,13 +93,14 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface | |||
*/ | |||
const ROUND_HALFDOWN = \NumberFormatter::ROUND_HALFDOWN; | |||
|
|||
// todo rename to scale in Symfony 3.0 |
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.
// @deprecated rename to scale in Symfony 3.0
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.
If we want forward compat, we should add $scale right now (and keep $precision in sync for BC)
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.
How can we make 2 properties in sync with eachother?
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.
alias them by reference ?
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.
But we could also make all props private in 3.0 as @stof suggested. Would be even better
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.
In that case, you can't make your code future compatible as you can no longer extend this class for that purpose?
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.
right, then only the comment needs an update, e.g // @deprecated: will be replaced by a $scale private property in 3.0
Please configure the allowed types (null|int) for |
93b74d6
to
f0ee681
Compare
I've fixed all remaining comments and created a doc PR. Ready to merge imo ✅ |
@@ -93,13 +93,16 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface | |||
*/ | |||
const ROUND_HALFDOWN = \NumberFormatter::ROUND_HALFDOWN; | |||
|
|||
/* |
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.
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.
Not sure about the deprecation at all. The class is meant to be extended (and also is extended in symfony itself). This why they are protected. It's just currently the case, that the properties are not needed to be read in subclasses. But making them private makes this impossible.
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.
But I agree deprecating all makes more sense than just one.
The idea lLooks good to me. @wouterj Can you address the comments? |
@fabpot I'm a bit unsure what to do:
|
ping |
For now, I've done (1). If I needed to do anything else, please say so :) |
👍 |
1 similar comment
👍 |
Thank you @wouterj. |
This PR was merged into the 2.7 branch. Discussion ---------- Deprecated precision option in favor of scale | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #7383 | License | MIT | Doc PR | symfony/symfony-docs#5005 Scale is the number of digits to the right of the decimal point in a number, precision isn't. See the referenced ticket for more context. Commits ------- 2a2f7e2 Deprecated precision option in favor of scale
This PR was merged into the 2.7 branch. Discussion ---------- Renamed precision option to scale | Q | A | --- | --- | Doc fix? | no | New docs? | yes (symfony/symfony#13717) | Applies to | 2.7+ | Fixed tickets | - Commits ------- 59ac3d5 Renamed precision option to scale
… (WouterJ) This PR was merged into the 2.8 branch. Discussion ---------- [2.8] [Form] Rename CollectionType options for entries Description --- Replaces #13820 for the 2.8 branch. Original description: > `type` and `options` are extremely generic. Prefixing them with `entry_` makes it clear what they are configuring. > About the property deprecation it is the same story as #13717 and I don't know which direction you want me to go. I've tried to apply the comments in the previous PR, but got a bit lost in the normalizers/default closure stuff. I hope I did everything correctly, but please review :) PR Info Table --- | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #7831 | License | MIT | Doc PR | symfony/symfony-docs#5051 Commits ------- 942a237 Rename CollectionType options for entries
… (WouterJ) This PR was merged into the 2.8 branch. Discussion ---------- [2.8] [Form] Rename CollectionType options for entries Description --- Replaces #13820 for the 2.8 branch. Original description: > `type` and `options` are extremely generic. Prefixing them with `entry_` makes it clear what they are configuring. > About the property deprecation it is the same story as symfony/symfony#13717 and I don't know which direction you want me to go. I've tried to apply the comments in the previous PR, but got a bit lost in the normalizers/default closure stuff. I hope I did everything correctly, but please review :) PR Info Table --- | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #7831 | License | MIT | Doc PR | symfony/symfony-docs#5051 Commits ------- 942a237 Rename CollectionType options for entries
… (WouterJ) This PR was merged into the 2.8 branch. Discussion ---------- [2.8] [Form] Rename CollectionType options for entries Description --- Replaces #13820 for the 2.8 branch. Original description: > `type` and `options` are extremely generic. Prefixing them with `entry_` makes it clear what they are configuring. > About the property deprecation it is the same story as symfony/symfony#13717 and I don't know which direction you want me to go. I've tried to apply the comments in the previous PR, but got a bit lost in the normalizers/default closure stuff. I hope I did everything correctly, but please review :) PR Info Table --- | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #7831 | License | MIT | Doc PR | symfony/symfony-docs#5051 Commits ------- 942a237 Rename CollectionType options for entries
Scale is the number of digits to the right of the decimal point in a number, precision isn't. See the referenced ticket for more context.