On 2. 6. 2026 at 17:13:38, Gina P. Banyard <[email protected]> wrote:

> As you already know from off list discussion I will vote against this RFC.
> I've laid my arguments in a blog post on my website. [1]
>

I really enjoyed your article about the generics RFC. Your arguments all
make sense and are well built and argued. These arguments are against
having bound-erased generic types and they are completely valid. The RFC
presents arguments for having bound-erased generic types in the languages
and they are also completely valid.

It’s good to point out and stress the point that the proposed generics are
not completely erased, they are still completely accessible in the
reflection (which could be taken advantage of by frameworks and apps to
deduplicate some information in the code) and they are bound-erased, which
means that some type-checking (which can be done cheaply) will still be
performed.

I’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 didn’t have to think hard about them, I’ve been
using these examples for years at the beginning of my presentations about
PHPStan and what errors in code it detects in contrast to PHP which doesn’t
detect them.


   - Foo::class - PHP will happily create literal string ‘Foo’ out of this
   even if class Foo does not exist.
   - catch (FooException) - PHP will not tell you you’re trying to catch an
   exception class (or interface) that does not exist (or can’t be a subtype
   of Throwable), it will silently skip this catch block.
   - Using a non-existent class as a property/parameter/return type. PHP
   will not error when loading the function or class with the method in
   question, but it will error on anything you will try to pass to it.
   - Using a trait name as a property/parameter/return type. PHP does not
   report an error on the declaration either, but it will error on anything
   you will try to pass to it. Including a class that uses the trait. Proof:
   https://3v4l.org/vH9Bn#v



So it’s not completely unprecedented. Sure, these examples might also
surprise a lot of developers writing PHP every day, but they’re there.

Ondřej Mirtes

Reply via email to