Re: [RFC] [Discussion] Bound-Erased Generic Types
| From: | Craig Francis | Date: | Fri, 15 May 2026 15:41:42 +0000 |
| Subject: | Re: [RFC] [Discussion] Bound-Erased Generic Types | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130892@lists.php.net to get a copy of this message | ||
On 15 May 2026, at 00:32, Seifeddine Gmati <azjezz@carthage.software> wrote:
> PHP's type system has grown one feature per RFC for a decade: scalar types, union types,
> intersection types, DNF, true/false/null types. None of those shipped the entire wishlist either.
>
class-string<T>, integer ranges, non-empty-string, negated
> types, and literal types can each be their own future RFC.
On this point; I still need to finish the RFC for a literal-string type, which already
exists in Psalm and PHPStan. I've been using Joe Watkins' is_literal() implementation with
3 big production websites for some time, and Robert Landers has a prototype implementation as a
proper type[1]. I just thought I'd give an example of a separate/small RFC.
Craig
[1] https://github.com/php/php-src/compare/master...bottledcode:php-src:add/literal-string-2