[php-src] Issue #13269: Unexpected behavior when using `void` as return type for the magic method `__invoke`
| From: | kvrushifa | Date: | Mon, 29 Jan 2024 12:31:25 +0000 |
| Subject: | [php-src] Issue #13269: Unexpected behavior when using `void` as return type for the magic method `__invoke` | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246357@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13269
Author: kvrushifa
### Description
The following code:
```php
<?php
class SomeClass {
public function __invoke(): void
{
echo true;
}
}
```
Resulted in this output:
```
// no error
```
But I expected this output instead:
```
Fatal error: SomeClass::__invoke(): Return type must be mixed when declared in /tmp/preview on line
8
```
See https://3v4l.org/PCutT
### PHP Version
8.1.12
### Operating System
_No response_