Re: Undocumented Nullable Return Behavior
| From: | Levi Morrison | Date: | Sun, 07 Aug 2016 07:54:33 +0000 |
| Subject: | Re: Undocumented Nullable Return Behavior | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-94891@lists.php.net to get a copy of this message | ||
On Sun, Aug 7, 2016 at 1:07 AM, Davey Shafik <me@daveyshafik.com> wrote:
> Hi internals,
>
> In the nullable types we do not allow implicit return null/return with no
> value to fulfill a nullable type.
>
> - No return will result in a TypeError when executed
> - Return with no value will be an actual fatal error, which I believe is
> due to the fact it's not found at runtime, should be a TypeError or
> ParseError if possible?
> - Return explicit null is fine (as expected)
>
> See: https://3v4l.org/h6IYF
>
> I believe the first two are contrary to PHP's "null is always returned if
> nothing else is".
>
> OTOH, it makes sense as it's the entire reasoning behind return void vs
> return null.
>
> This behavior is completely undocumented in the RFC.
>
> It's definitely something we should make an explicit decision on for the
> language spec if nothing else.
>
> We should also make any decisions on this prior to beta3 in < 2 weeks.
>
> Thoughts?
>
> - Davey
>
hello_2 looks particularly fishy to me; to my knowledge we did not pass any
RFCs that would dictate such a message. However I have not been as active
as I'd like to be so perhaps I just missed it.