> As for when to allow them: as others have suggested in this thread, keep it simple for now, and only allow intersection of class/interface references.
Yes, I think that single intersection type should support just one class and any/or any number of interfaces with the condition that they don't collide with one another. > If you want to raise an RFC, special care has to be taken for the variance in inheritance semantics. I don't think neither that I am able to consider all possible impacts to write the RFC nor implement this, but Levi Morrison (le...@php.net) can. On Sun, Nov 8, 2020 at 4:53 PM Marco Pivetta <ocram...@gmail.com> wrote: > Hey Eugene, > > On Sat, Nov 7, 2020 at 4:13 PM Eugene Sidelnyk <zsidel...@gmail.com> > wrote: > >> ```php >> function foo(A & B & E $object) { >> // some work >> >> var_dump($object); >> } >> ``` >> > > Fully support this for parameter, property and return types: already > making good use of intersection types since a few years. > > As for when to allow them: as others have suggested in this thread, keep > it simple for now, and only allow intersection of class/interface > references. > > If you want to raise an RFC, special care has to be taken for the variance > in inheritance semantics. > > Greets, > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ >