[php-src] Issue #7900: `never` return type for arrow functions with throw expressions
| From: | weirdan | Date: | Fri, 07 Jan 2022 07:38:50 +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-238834@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7900
Author: weirdan
### Description
The following code:
```php
<?php
fn(): never => throw new Exception;
```
Resulted in this output:
```
Fatal error: A never-returning function must not return in /in/qWWuD on line 3
```
But I expected this output instead:
```
```
Obviously, it's caused by implicit return, but throw expressions never actually return.
### PHP Version
8.1.x
### Operating System
_No response_