Hi!

> 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.

I'm not sure what it is useful for, exactly. I mean, the more fatal
errors the merrier, but I fail to see what exactly use except having yet
more cases when your code may break it provides. I mean, if you defined
a void function, that means you're not using it return value anywhere.
Then who cares what return statement says? If you _are_ using its return
value, then a) why you declared it as void and b) how comes you expect
return value from a function that is supposed to always return null?

Additionally, this RFC gets inheritance wrong - having return from
function that previously did not return anything is not a violation of
contract, since there's no practical contract that can rely on function
not returning anything (in fact, there's no way in PHP to even check
that AFAIK).

Summarily, this seems to me an exercise in strictness for the sake of
strictness. There are languages that force people to abide by a lot of
rules because their creators believe more rules is the same as better
code, but PHP never was one of them and the fact there are so many
people trying to make PHP that makes me sad.
-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to