On 10/03/2021 19:21, Matthew Brown wrote:
If the Zend engine hits that operand — which only happens if a
throw/exit *hasn't* been encountered — it emits a TypeError.
Right, that should probably be spelled out in the RFC. Checking at
run-time in that way is consistent with actual return types, but
inconsistent with "void", which performs all its checking at compile-time.
On that note, the "comparison to void" section could maybe more clearly
call out the difference in behaviour, rather than showing the happy path
for both. If I understand right:
- the "sayHello" function would give an error at runtime if marked
"noreturn"
- the "redirect" function would run fine if marked "void"
- a function containing "return null;" would fail at compile time for both
- a function containing "return;" would be OK for "void", but fail at
compile time for "noreturn"?
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php