Re: Class Extension
| From: | Holly Schilling | Date: | Fri, 10 Jul 2026 12:46:08 +0000 |
| Subject: | Re: Class Extension | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131855@lists.php.net to get a copy of this message | ||
> There is no such check in PHP. Static Analysis tools may warn about it, but a trait will
> compile fine with code that refers to unknown members. The code will then succeed or fail at runtime
> just like any other object access:
I have to admit I never knew that worked. I genuinely learned something new today.
Now knowing that, it makes the case for using a different keyword like
extension much
stronger since that is not the case for an extension. Everything on an extension is type-checked at
compile time, save some edge cases with scalars.