On Monday, 2 June 2025 at 18:08, Kamil Tekiela <tekiela...@gmail.com> wrote:

> The RFC mentions that this will now become valid:
> 
> function foo(): void {
> return null;
> }
> 
> But what about the opposite:
> 
> function foo(): null {
> return;
> }

This would also work indeed.

> or what Larry was trying to suggest:
> 
> function foo(): null {
> print 'test';
> }
> 
> $val = foo();

This would also work, as null and void would be isomorphic.
However, if you have a return type of T|null then you'd get errors in both 
cases.

I will clarify this in the RFC.


Best regards,

Gina P. Banyard

Reply via email to