Hi! > One of the primary purposes of having typehints *is* documentation. This
Documentation causing fatal errors is something quite unusual. And wrong. > applies both to our existing type annotations, to the newly introduced That is not true, for existing types documentation is not the only and not the primary purpose. Primary purpose is ensuring the method gets the value it expects. Otherwise phpdoc would be enough. > return declarations - and to the void return type. The advantage of > having the type declaration be part of the language (rather than a > docblock) is brevity on one hand and verification of its correctness on > the other hand. It's easy to forget to update docblock type annotations There's absolutely no brevity advantage and verification, as I mentioned, in this case is not very useful. > The void return type is actually the one case where we can at > compile-time fully verify that it is used correctly - which is great. No, you can not, since you have no idea how your function is used and where. > Allowing to return a value from a void function doesn't make sense. If Having language-enforced concept of "void function" in PHP doesn't make sense. PHP functions always return values, and verifying that function pretends to not return value has no use, as no code can depend on it. > you want to return a value, don't declare it as void. If you declare it > as void, don't return a value. It's really as simple as that. That's exactly kind of thing that makes me sad. Inviting rules in the language that exist for their own sake and then saying "well, you don't like it, don't break the rules!" -- Stas Malyshev smalys...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php