[php-src] Issue #7900: `never` return type for arrow functions with throw expressions
| From: | iluuu1994 | Date: | Fri, 07 Jan 2022 12:50:14 +0000 |
| Subject: | [php-src] Issue #7900: `never` return type for arrow functions with throw expressions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238853@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7900
Comment Author: iluuu1994
> Otherwise PHP would need looking at the return type in signature to decide if the statement
> value must be returned or not? It seems icky
Yes, PHP could add the return depending on whether the function is
void/never or not. FWIW other languages do the same. E.g. for Swift [this
was a problem in the
past](https://stackoverflow.com/questions/24150400/one-line-closure-without-return-type) but they
now just drop the value when the closure is explicitly marked as returning ().