2 ms·
The point I was trying to make is that PHP does not have -- nor should it have, I think -- a concept of void. Functions without a return statement already retur
by arenaninja 10y ago
The point I was trying to make is that PHP does not have -- nor should it have, I think -- a concept of void. Functions without a return statement already return null. "return;" is already equivalent to "return null;" as well, as you pointed out. It would be more consistent to type-hint return null instead of introducing a new return type (void) into the language. I know PHPDoc already uses "@return void", and I have never liked it for the same reason. It is not a concept used anywhere else in PHP, AFAIK.
- wtetzner 10y agoI think having a void return type makes a lot of sense, because it says "this function will never return anything but null".