[php-src] Issue #12718: Override attribute above __toString() without parent class does not throw
| From: | mvorisek | Date: | Sat, 18 Nov 2023 14:55:24 +0000 |
| Subject: | [php-src] Issue #12718: Override attribute above __toString() without parent class does not throw | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245836@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12718
Author: mvorisek
### Description
The following code:
```php
<?php
class A {
#[\Override]
public function __toString(): string {}
}
```
https://3v4l.org/FqgcS/rfc#vgit.master
Resulted in this output:
no output
But I expected this output instead:
```
Fatal error: A::__toString() has #[\Override] attribute, but no matching parent method exists
```
### PHP Version
PHP 8.3+
### Operating System
any