RE: [PHP-DEV] [RFC] Void Return Type
| From: | François Laupretre | Date: | Sat, 14 Feb 2015 04:57:34 +0000 |
| Subject: | RE: [PHP-DEV] [RFC] Void Return Type | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82668@lists.php.net to get a copy of this message | ||
> De : Andrea Faulds [mailto:ajf@ajf.me]
> I’ve written a small RFC and patch to add a “void” return type:
>
> https://wiki.php.net/rfc/void_return_type
>
> Please have a read over it. I think this would be a simple, yet useful addition.
That's a nice addition and a beginning to distinguish void from null, as I imagine the function
still returns null.
Now, what about making void a real zval type ? It would open a lot of possibilities. Unlike null,
conversions from void would raise an error. It would also be rejected as argument input type but
could be used as an output type when arg is passed by ref, it could be the default type for
return_value (huge BC break here) and so on...
There's a need for a real 'no value' type different from null, as null has too many
uses. If defined correctly, it can be a powerful addition.
François