Skip to content

Update Range.rst #10918

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
Jan 22, 2019
Merged

Update Range.rst #10918

merged 1 commit into from
Jan 22, 2019

Conversation

DonCallisto
Copy link
Contributor

I think that int is kind of misleading here as any is_numeric value evaluated to true is accepted (other than strings).
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Constraints/RangeValidator.php#L36
I've done this PR for 3.4 but I think it should be reported to all next versions as well.

I think that `int` is kind of misleading here as any `is_numeric` value evaluated to `true` is accepted (other than strings). 
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Constraints/RangeValidator.php#L36
I've done this PR for 3.4 but I think it should be reported to all next versions as well.
@javiereguiluz
Copy link
Member

javiereguiluz commented Jan 22, 2019

I think this proposed change is correct because the code literally checks for numeric values, not only integers: https://github.com/symfony/symfony/blob/aca3d2c90d3ad01687771ce75602fed5b12bcf2b/src/Symfony/Component/Validator/Constraints/RangeValidator.php#L36

@@ -320,15 +320,15 @@ Options
min
~~~

**type**: ``int`` or ``string`` (date format)
**type**: ``numeric`` or ``string`` (date format)
Copy link
Contributor

Choose a reason for hiding this comment

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

we should call it number IMHO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was doubtful indeed. Is true that number is better but numeric gives the reader back additional infos somehow. Don't know if number (same for numeric of course) is used elsewhere in docs. Whe should try adopt that standard (if any)

@javiereguiluz javiereguiluz added this to the 3.4 milestone Jan 22, 2019
@javiereguiluz javiereguiluz merged commit ddeea95 into symfony:3.4 Jan 22, 2019
javiereguiluz added a commit that referenced this pull request Jan 22, 2019
This PR was merged into the 3.4 branch.

Discussion
----------

Update Range.rst

I think that `int` is kind of misleading here as any `is_numeric` value evaluated to `true` is accepted (other than strings).
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Constraints/RangeValidator.php#L36
I've done this PR for 3.4 but I think it should be reported to all next versions as well.

Commits
-------

ddeea95 Update Range.rst
@javiereguiluz
Copy link
Member

@DonCallisto thanks for this! I couldn't find other occurrences of "number" or "numeric", so I changed it to "number" while merging, because I think it sounds better.

@DonCallisto
Copy link
Contributor Author

Ok, cheers 🍻 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants