> On 10/08/2021 13:39, Nicolas Grekas wrote:
> > I will wait if I don't have the choice, but as many others reported, the
> > experience with 7.0 missing nullability was a pain.
>
> Apologies if you already did and I've forgotten, but could you please
> expand on what "pain" you are referring to here?
>

I personally did not experience that pain because I just skipped 7.0, since
it wouldn't allow expressing the nullable return types I had to express in
the APIs I maintain.

Firstly, I'm guessing we're talking about return types here, since
> parameters have had types since 5.0, and nullable types since 5.1 with
> the "TypeName $foo = null" syntax?
>

That's correct. And that made me realize I missed highlighting that the
situation with intersection types is actually worse than the one we had in
7.0 vs 7.1. As of https://github.com/php/php-src/pull/7254, not only return
types, but also *arguments* are affected by the non-nullable limitation. If
the RFC doesn't pass, I would still be in favor of reverting that part of
the PR. That would bring us a situation very similar to 7.0 vs 7.1, which
was not ideal but still better.


> Secondly, do you mean you postponed your adoption of the feature, or was
> there some larger issue?
>

I postponed it (and others did, as reported by Benjamin and Tobias in a
previous message.)
Note that I'm not running this RFC for my own personal benefit. I'm running
it because I care about making PHP (and each release of it) as good as
possible. I will postpone adopting the feature if I don't have the choice.
But until it's too late, I'm willing to engage in this topic because I
think the current state is far from ideal for 8.1.

The larger issue is that when used as a type on arguments, adding the
nullability flag isn't possible without a BC breaking change.

Regards,
Nicolas

Reply via email to