On 15.06.26 06:53, Ben Ramsey wrote:
On 6/14/26 20:22, Seifeddine Gmati wrote:Hello Internals, I'd like to start the discussion on a new RFC adding literal scalar types to PHP. - RFC: https://wiki.php.net/rfc/literal_scalar_types - Implementation: https://github.com/php/php-src/pull/22314 Thanks, Seifeddine.I think I'm okay with this. David mentioned enums, and I do think enums are useful in many places where you want types like this, but there's a simplicity in this that I can't deny, and I like it.
I do like the simplicity of this.But - especially for floats and ints - the next level would be to allow not only
``` public function check(int -1|0|1 $minusOneThroughOne) ``` but also something like ``` public function check(int -1..1 $minusOneThrougOne) ``` which would then also allow ``` public function check (int 1..PHP_INT_MAX $positiveInt) ```would that also be something to be considered? It seems like a logical alternate option to not have to add every value literally to the option list...
Cheers
Andreas
--
,,,
(o o)
+---------------------------------------------------------ooO-(_)-Ooo-+
| Andreas Heigl |
| mailto:[email protected] N 50°22'59.5" E 08°23'58" |
| https://andreas.heigl.org |
+---------------------------------------------------------------------+
| https://hei.gl/appointmentwithandreas |
+---------------------------------------------------------------------+
| GPG-Key: https://hei.gl/keyandreasheiglorg |
+---------------------------------------------------------------------+
OpenPGP_signature.asc
Description: OpenPGP digital signature
