Re: [RFC] [Discussion] Bound-Erased Generic Types
| From: | Ondřej Mirtes | Date: | Thu, 04 Jun 2026 10:58:46 +0000 |
| Subject: | Re: [RFC] [Discussion] Bound-Erased Generic Types | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131132@lists.php.net to get a copy of this message | ||
On 4. 6. 2026 at 12:29:42, Ondřej Mirtes <ondrej@mirtes.cz> wrote:
> ’d also like to point out a few places in currently shipping PHP version
> where you can put types in native syntax and they are not checked at
> runtime, meaning completely wrong and non-existent types are silently being
> accepted or skipped.
>
I just remembered one more place: attributes. They’re not validated until
something tries to newInstance them via reflection. Which might be never.
They can be invalid for all kinds of reasons - nonexistent class, class
that isn’t an attribute, targeting wrong target. Proof:
https://3v4l.org/Pmai6#v
Ondřej Mirtes