Re: Return type declaration and &return.falseforfailure;
| From: | Steve Petcu | Date: | Mon, 12 Feb 2018 13:51:24 +0000 |
| Subject: | Re: Return type declaration and &return.falseforfailure; | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969386887@lists.php.net to get a copy of this message | ||
Afaik userland functions return null if no return specified, but I thought
there are native functions that actually don’t return anything.
And void should not work as a return type for functions that return null,
according to the docs: http://php.net/manual/en/migration71.new-features.php
—
Stefan Petcu
On Mon, 12 Feb 2018 at 10:26, Richard Quadling <rquadling@gmail.com> wrote:
> Hmm. I've always thought that null was no result.
> https://3v4l.org/pjHBl#vhhvm-3213
>
> With the new void return type, which is explicitly saying nothing is
> returned, null is still assigned as it indicates a nothing, not a something.
>
>
> On 11 February 2018 at 23:15, Christoph M. Becker <cmbecker69@gmx.de>
> wrote:
>
>> On 11.02.2018 at 23:56, Richard Quadling wrote:
>>
>> > We should be adding <void> if there is no return value. If a function
>> can
>> > return null, then that's a valid return type. […]
>>
>> Most functions return NULL, if you give them invalid parameter types,
>> e.g. <https://3v4l.org/UIYGh>.
>>
>> > […] The issue here is that many
>> > of the PHP functions return way too many types.
>>
>> ACK. However, changing that constitutes a BC break, and as such has to
>> be thoroughly investigated (likely on a case by case basis), and most
>> likely would require the RFC process
>> (<https://wiki.php.net/rfc/howto>).
>>
>> --
>> Christoph M. Becker
>>
>
>
>
> --
> Richard Quadling
>
>