On Thu, Apr 1, 2021 at 6:07 PM Benjamin Eberlei <kontakt@beberlei.de> wrote:
>
> ```php
> if (!isset($user)) {
> throw new NotFoundException();
> }
> ```
>
Since throw is an expression (since PHP 8.0,
https://wiki.php.net/rfc/throw_expression),
it must have a type for its
result,
as any expression has a type. And it's result is exactly noreturn (or
never, as this option seems to be preferred
judging by current vote results), because throw never returns.
It's quite natural to extend that to function calls that never return as
well. And then it makes sense to declare that type
as a part of function signature like you can do with other types.
--
Best regards,
Bruce Weirdan mailto:
weirdan@gmail.com