On 29 October 2015 at 12:52, Stanislav Malyshev <[email protected]> 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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php