Re: [PHP-DEV] Class Extension

[email protected] (Michael Morris) Wed, 8 Jul 2026 08:07:07 -0400
Newsgroups php.internals
Message-ID <CAEUnE0fgdMnfovaacup3OTW6KMqvbidBeNt0-Ote4h8=6H5tOQ@mail.gmail.com>
On Wed, Jul 8, 2026 at 1:08 AM Holly Schilling <
[email protected]> wrote:

> Following the discussion in Discord yesterday, I started working on the
> feasibility of implementing class extensions. I believe I’ve proven out the
> concept and viability of it in a 2-phase approach using an extension syntax
> similar to that of Swift.
>
> Before I go into much more detail, what is the general interest in adding
> this to the language?
>

We have inheritance (extends keyword, parent / child classes)
We have traits (an implementation of multiple classes taken from Ruby)

Looking at Swift's extension syntax I fail to see anything it adds not
covered by the above.