On Wed, 10 Mar 2021 at 13:55, Rowan Tommins <rowan.coll...@gmail.com> wrote:
> I am however slightly confused by what exactly the implementation > checks, and when. Is it actually looking for "exit" and "throw" statements? > No. Any function annotated with `: noreturn` causes the engine to insert a ZEND_VERIFY_NORETURN_TYPE op at the end of the function's operands. If the Zend engine hits that operand — which only happens if a throw/exit *hasn't* been encountered — it emits a TypeError. The other thing I'd like to mention is that PHP's implementation of > "void" consists mostly of checking that there is no return statement, so > a separate keyword of "noreturn" may well cause confusion. I would > personally prefer the name "never" for this reason. > If a significant number agree I can add a secondary vote on noreturn vs never, but never introduces more of a BC risk. Best wishes, Matt