1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

[RFC] Add clamp function (#19434)

* Implement clamp function

Co-authored-by: thinkverse <hallberg.kim@gmail.com>

* - Use a common function for normal and frameless implementations
- Add tests for null and not-comparable cases
- Fix object support for frameless clamp function
- Improve NAN handling

* Create tests triggering both frameless and dynamic variants

* Add changelog

* [Review] rephrase error messages to use "must not"

* Enable assert()

---------

Co-authored-by: thinkverse <hallberg.kim@gmail.com>
This commit is contained in:
Kyle
2025-12-18 20:27:30 +01:00
committed by GitHub
parent 833120eb72
commit 06ea0e5df1
6 changed files with 186 additions and 1 deletions

View File

@@ -71,6 +71,10 @@ PHP 8.6 UPGRADE NOTES
6. New Functions
========================================
- Standard:
. `clamp()` returns the given value if in range, else return the nearest bound.
RFC: https://wiki.php.net/rfc/clamp_v2
========================================
7. New Classes and Interfaces
========================================