Hi Jordan, Does it make sense to explain in the RFC the difference between never and mixed in this context? The RFC vaguely mentions that never can never be used directly, but if it's limited to abstract class and interfaces, isn't that already impossible to use directly? Or does it mean that the type would "be allowed" on any function, but because of its intrinsic behavior it would always fail if used in non-abstract methods?
Another clarification I'd be interested is about dropping the type declaration entirely (e.g. https://3v4l.org/a4bfs), because of covariance (or contravariance, I never know), sub classes can completely drop type declaration entirely. Will never not allow this? Why? Why not? If it does allow this, does it really differ from not having any type declaration on the abstract function? My knowledge in this area is practically null so if I'm asking stupid questions that are easily explained by some blog post I'd he happy to read it. On Sat, Aug 14, 2021, 01:27 Jordan LeDoux <jordan.led...@gmail.com> wrote: > Hey internals, > > I've been working on the draft for my operator overloading RFC, and in > doing so I encountered a separate change that I would like to see. > > That is, the use of `never` as an argument type for interfaces. Since > arguments in PHP are contravariant to preserve Liskov substitution, `never` > as the bottom type should indicate that implementing classes can require > any type combination they want. This is in fact consistent with type theory > and set theory, and is how the bottom type is treated in several other > languages. > > In this case, the bottom type would be used to indicate covariant parameter > polymorphism while not conflicting with LSP. > > This would provide a sort of minimal form of generics to PHP without the > issues that actual generics present from an implementation perspective. It > would not, however, restrict or hinder any future RFC for generics. > > This is at the first draft stage, and I currently have the RFC on a github > repo to allow for easy contribution and collaboration. > > Any feedback is greatly appreciated. > > https://github.com/JordanRL/never-argument-type > > Jordan >