Re:Upcoming changes in PHP 7.1
by arenaninja on Monday May 23, 2016 @10:30AM
(#11754051)
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.
There's a lot of code that uses "return;" to mean "return null;" and honestly I don't see it as a big problem.