Skip to content

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

Merged
merged 1 commit into from
Apr 3, 2015
Merged

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Feb 17, 2015

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.

@@ -93,13 +93,13 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
*/
const ROUND_HALFDOWN = \NumberFormatter::ROUND_HALFDOWN;

protected $precision;
protected $scale;
Copy link
Member

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)

@wouterj
Copy link
Member Author

wouterj commented Feb 17, 2015

Thanks @stof. I've applied some fixes to this PR.

@wouterj
Copy link
Member Author

wouterj commented Feb 17, 2015

failures look unrelated

@fabpot
Copy link
Member

fabpot commented Feb 18, 2015

👍

@@ -93,13 +93,14 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
*/
const ROUND_HALFDOWN = \NumberFormatter::ROUND_HALFDOWN;

// todo rename to scale in Symfony 3.0
Copy link
Member

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

Copy link
Member

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)

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alias them by reference ?

Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member

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

@Tobion
Copy link
Contributor

Tobion commented Feb 18, 2015

Please configure the allowed types (null|int) for scale with setAllowedTypes.

@wouterj
Copy link
Member Author

wouterj commented Feb 18, 2015

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;

/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last comment sorry :) /** here?
But more importantly (for @stof or @Tobion): shouldn't we also deprecate the $grouping and $roundingMode props and make the private in 3.0?

Copy link
Contributor

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.

Copy link
Contributor

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.

@fabpot fabpot added the Form label Feb 25, 2015
@fabpot
Copy link
Member

fabpot commented Feb 25, 2015

The idea lLooks good to me. @wouterj Can you address the comments?

@wouterj
Copy link
Member Author

wouterj commented Feb 27, 2015

@fabpot I'm a bit unsure what to do:

  1. Just change /* to /**
  2. (1) + deprecate all other properties
  3. (1) + changing message to only mention rename (and not change to private) + adding renamed property for future compatibility

@wouterj
Copy link
Member Author

wouterj commented Mar 20, 2015

ping

@wouterj
Copy link
Member Author

wouterj commented Apr 3, 2015

For now, I've done (1). If I needed to do anything else, please say so :)

@Tobion
Copy link
Contributor

Tobion commented Apr 3, 2015

👍

1 similar comment
@aitboudad
Copy link
Contributor

👍

@fabpot
Copy link
Member

fabpot commented Apr 3, 2015

Thank you @wouterj.

@fabpot fabpot merged commit 2a2f7e2 into symfony:2.7 Apr 3, 2015
fabpot added a commit that referenced this pull request Apr 3, 2015
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
@wouterj wouterj deleted the issue_7383 branch April 3, 2015 17:28
weaverryan added a commit to symfony/symfony-docs that referenced this pull request May 3, 2015
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
fabpot added a commit that referenced this pull request Oct 11, 2015
… (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
fabpot added a commit to symfony/form that referenced this pull request Oct 11, 2015
… (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
fabpot added a commit to symfony/form that referenced this pull request Oct 12, 2015
… (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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants