Re: [VOTE] Void Return Type RFC

From: Date: Thu, 29 Oct 2015 12:58:07 +0000
Subject: Re: [VOTE] Void Return Type RFC
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-88994@lists.php.net to get a copy of this message
On 29 October 2015 at 12:52, Stanislav Malyshev <smalyshev@gmail.com> wrote: > I don't think we should do either. The whole story bases on the premise > that it is very important to avoid functions that accidentally return > non-null value. I don't think we should do either. The whole story bases on the premise that it is very important to avoid functions that accidentally return non-null value. The use case is that it allows better static analysis function foo() : null { ... } function bar() { ... } function zot(int $fot) { ... } This code: zot(foo()); is an error detectable through static analysis, without having to look at the docblock. This code: zot(bar()); is not detectably an error. It might be if you look at the docblocks, but I dislike having to depend on comments which don't always reflect accurately on the code. cheers Dan

« previous php.internals (#88994) next »