> 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
>

For the record, I was suggested to add a few more words about reflection in
the RFC.

In "Proposal", I added this:
> On the reflection side, ''ReflectionIntersectionType::allowsNull()'' will
return ''true''/''false'' depending on what the intersection type accepts.

In "Rationale", I added this:
> About reflection, one could imagine a more complex model based on a
''ReflectionIntersectionType'' nested inside a ''ReflectionUnionType''.
This RFC proposes to rely on ''ReflectionIntersectionType::allowsNull()''
instead. This is consistent with how ''T|null'' is returned without
''ReflectionUnionType'' wrapper, and is also simpler for userland to deal
with.

Reply via email to