[php-src] Issue #12639: `__toString` LSP is not checked since PHP 8.0
| From: | mvorisek | Date: | Thu, 09 Nov 2023 14:38:17 +0000 |
| Subject: | [php-src] Issue #12639: `__toString` LSP is not checked since PHP 8.0 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245768@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12639
Author: mvorisek
### Description
The following code:
```php
<?php
interface StreamInterface
{
public function __toString(): string;
}
class X implements StreamInterface
{
public function __toString() {
return 'x';
}
}
```
Resulted in this output:
```
```
But I expected this output instead:
```
Fatal error: Declaration of X::__toString() must be compatible with StreamInterface::__toString():
string
```
repro: https://3v4l.org/XfgXZ
with any other method the LSP is checked/required
### PHP Version
8.0+
### Operating System
any