Hey George, <http://ocramius.github.com/> On Tue, Mar 23, 2021 at 10:32 AM G. P. B. <george.bany...@gmail.com> wrote:
> Greetings internals, > > I'm presenting a new RFC to add support for pure intersection types to PHP. > > An intersection type A&B means that the value must be of type A and of type > B at the same time. > > I'm calling this proposal pure intersection types as there would be no > possibility of mixing intersection and union types, I'm leaving this as a > future scope. > > The current draft is located on GitHub: > https://github.com/Girgias/intersection-types > And the current implementation PR is: > https://github.com/php/php-src/pull/6799 > > Looking forward to the feedback. > Overall, totally for this, even if it is just the "pure" form that does not yet support composite expressions. I suppose that `ReflectionIntersectionType` will likely be the most interesting part of it, potentially hardcoding `ReflectionIntersectionType#allowsNull()` as `false` for now? (analogous to https://www.php.net/manual/en/class.reflectionuniontype.php ) Greets, Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/