On Fri, Jul 23, 2021 at 4:58 AM Nicolas Grekas <nicolas.gre...@gmail.com> wrote:
> https://wiki.php.net/rfc/nullable_intersection_types > > I've commented on the PR and in R11 a bit already, but I'd like to state my position here for the record. I do see the value in having nullability, but I can't disagree enough with the `?X&Y` syntax no matter how technically right the argument about operator precedence is. Even ignoring that literally nobody carries around a complete operator precedence table in their head, we simply can't predict how making this decision now will impact future plans for combined intersection/union types. The same argument honestly goes for every other syntax proposed, including `(X&Y)|null` which is also prone to making things worse. Nullable intersection types *IS* an implementation of combined intersection/union types, even if a narrow one. Those have not been planned out or approved, and they're too broad to sneak in post feature freeze. Period. Let's take the coming months to flesh out the edge cases on combined types. Let's maybe even look into type aliasing, which may have the side effect of making combined types more readable (or maybe less, who knows!). Most importantly, let's accept the fact that PHP's release cycle is only 12 months and we had pandemics that lasted longer than that. Next year is right around the corner. TL;DR - I've decided my vote. -Sara