Re: [RFC] Void Return Type (v0.2, reöpeni ng)
| From: | Ryan Pallas | Date: | Wed, 14 Oct 2015 22:50:41 +0000 |
| Subject: | Re: [RFC] Void Return Type (v0.2, reöpeni ng) | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88797@lists.php.net to get a copy of this message | ||
On Wed, Oct 14, 2015 at 4:46 PM, Levi Morrison <levim@php.net> wrote:
>
>
> I agree that
void doesn't make sense given that we
> document that
> return; will return null[1]. If the union types RFC[2] passes
> it
> makes sense to allow Foo | null which allows something of type
> Foo
> or null. To me it makes sense that if you then remove
> Foo you are
> left with null, not void. My
> personal recommendation because of
> this would be to use null for the return type and instead of
> void.
>
> Also, I do not think this feature is pointless. For instance, it has
> value in interfaces. Declaring that a method does not return a value
> means implementors cannot accidentally return something. This is
> better than just documenting that it should not be done.
+1 these are my thoughts exactly. I would be for it if it was null, and
interfaces is exactly why I would be for it.