揮発性のメモ2

http://d.hatena.ne.jp/iww/

PHPDocで戻り値の無い関数のコメント

PHPはreturnのない関数の戻り値はNULLである。
PHP: 返り値 - Manual
でもそれは言語仕様的な話で、戻り値が無いことを明示するときはvoidを使うらしい。
phpDocumentor: Types
phpDocumentor: @return
php - PHPDoc: @return void necessary? - Stack Overflow

<?
/**
 * ハロー
 * @return void
 */
function hello(){
    print("hello\n");
}

$a = hello();
print( "return is ". gettype($a) ."\n");
hello
return is NULL


でもそんなん嫌だという人もいる。
http://code.garyjones.co.uk/why-return-void-is-wrong