Hey Seifeddine, > Am 15.06.2026 um 03:22 schrieb Seifeddine Gmati <[email protected]>: > > 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 you are solving the wrong (or rather: only a specific subset of the) problem. What you _actually_ probably want is pattern support in type positions. Let me know if I'm wrong in my assumption here. I.e. basically support expressions as specified by https://wiki.php.net/rfc/pattern-matching in property and function argument/return positions. Which does this, and ranges and everything else you'd need. Which is a worthwhile addition, but we should first get pattern-matching done, then we can do one RFC broadening the applicability of patterns. Bob
