-
Notifications
You must be signed in to change notification settings - Fork 8k
[RFC] Add clamp function #19434
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
base: master
Are you sure you want to change the base?
[RFC] Add clamp function #19434
Conversation
a6d8707 to
d6f035f
Compare
|
The RFC page status is set to Withdrawn, update it to Draft if you have access. |
a499c4c to
408f386
Compare
f61c646 to
47446f8
Compare
47446f8 to
37cbb4a
Compare
|
Hello @kocsismate and @bukka, any news about this proposal to reconsider |
|
@kylekatarnls RFCs are discussed on the mailing list and then need to be voted on. See https://wiki.php.net/rfc/howto for an explanation of the process. |
|
Thanks. I'd like to participate there, but I failed to create a wiki account, the captcha stuff is asking me "To which email address do you have to send an email to now?" and re-reading the whole page, I tried |
That is accurate: What error message did you receive? |
|
Thanks for pointing me to the source code of the wiki, my error was |
f973850 to
b39d140
Compare
3450a45 to
386cbd4
Compare
e1bcf76 to
4f07c5d
Compare
d05dd81 to
a137881
Compare
|
Thanks for the changes. The only thing missing right now is testing the non-frameless version. Because you have a test file that only utilises the global namespace, it can use the frameless variant. So the code path from the non-frameless version isn't tested. |
|
Hi thanks for the review, I was off and didn't check deep yet, I though it was a matter of |
|
@kylekatarnls I would do something like this: https://gist.github.com/ndossche/33f72df9907ecfd8b0493c7e50d4494a The diff looks a bit messy, but the idea is to call clamp() twice and assert the result is the same: once we call it as an FLF, once dynamically via an FCC. For exceptions, we make a wrapper function that executes both variants with try-catch. |
ca0d781 to
a137881
Compare
|
Thanks for the help @ndossche I verified both were used by giving them different behaviors, and confirm It's now covered. |
|
Since the newly added test also tests everything the original test file tests, I think the original became redundant. |
e17b5dd to
a86b974
Compare
ndossche
left a comment
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.
Thanks.
Please add an entry to the NEWS file and an entry to UPGRADING. The entry in UPGRADING should contain a short description of the feature and a line that links to your RFC.
3f71768 to
e8d3690
Compare
ndossche
left a comment
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.
Thanks.
LGTM, I'll wait a bit to see if more feedback comes in but I don't expect that.
I'll merge in a few days if no one else replies.
Girgias
left a comment
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.
Minor nits, but implementation looks good otherwise
Co-authored-by: thinkverse <[email protected]>
- Add tests for null and not-comparable cases - Fix object support for frameless clamp function - Improve NAN handling
6fbecd3 to
a2b5253
Compare
TimWolla
left a comment
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.
LGTM except that.
Follow-up #7191
Implementation for the RFC: https://wiki.php.net/rfc/clamp_v2 (see also https://wiki.php.net/rfc/clamp)
Documentation: php/doc-en#4814