> On Jul 23, 2021, at 5:58 AM, Nicolas Grekas <nicolas.gre...@gmail.com> wrote: > > Hi everyone, > > as proposed by Nikita and Joe, I'm submitting this late RFC for your > consideration for inclusion in PHP 8.1. Intersection types as currently > accepted are not nullable. This RFC proposes to make them so. > > I wrote everything down about the reasons why here: > https://wiki.php.net/rfc/nullable_intersection_types > > Please have a look and let me know what you think. > > Have a nice read, > > Nicolas
It seems this RFC is actually trying to accomplish two(2) things: 1. Add typehints for nullable intersection types to PHP. 2. Get PHP to support a preferred syntax for type-hinting nullable intersection types. Further: A. There seems to be consensus on the value of #1. B. There seems to be consensus on using a syntax with parentheses for #1. C. There is a lot of pushback on #2. D. The desired syntax in #2 would reduce future flexibility, as Larry Garfield commented. Given both of these sets of assertions I would ask the RFC's author and proponents what would be a worse outcome? X. Getting typehints for nullable intersection types added to PHP, but not the desired syntax? Y. Not getting typehints for nullable intersection types added to PHP? When answering please consider that #X is the outcome that would not preclude possibly getting #2 at a future date. --------- Also, the entire discussion has claimed a "need" for nullable intersection types but AFAIIK they have been presented in completely abstract terms; i.e. no one has presented any real-world scenarios where they would actually use nullable intersection types. It might be helpful — or at least it would be for me — if the RFC could add two or three real-world example use-cases where the author and proponents would actually like to use nullable intersection types in their future PHP code. #jmtcw -Mike