Re: [PHP-DEV] Class Extension
[email protected] (Holly Schilling) Fri, 10 Jul 2026 12:46:08 +0000
| Newsgroups | php.internals |
|---|---|
| Message-ID | <DS4PR20MB9945334CB2253697BA5E417018B2FD2@DS4PR20MB994533.namprd20.prod.outlook.com> |
> 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.