[php-src] Issue #15994: Confusing error message: anonymous class with inherited abstract methods
| From: | DanielEScherzer | Date: | Sun, 22 Sep 2024 21:50:38 +0000 |
| Subject: | [php-src] Issue #15994: Confusing error message: anonymous class with inherited abstract methods | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247859@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15994
Author: DanielEScherzer
### Description
The following code:
```php
<?php
trait T {
abstract public function f();
}
$c = new class {
use T;
};
```
Resulted in this output:
```
Fatal error: Class class@anonymous contains 1 abstract method and must therefore be declared
abstract or implement the remaining methods (class@anonymous::f) in /in/gQfJj on line 7
Process exited with code 255.
```
But I expected this output instead:
```
Fatal error: Class class@anonymous contains 1 abstract method and must implement the remaining
method (class@anonymous::f) in /in/gQfJj on line 7
Process exited with code 255.
```
Similar issue with
```
trait T {
abstract public function f();
}
abstract class C {
use T;
}
$c = new class extends C {};
```
(the "remaining method" being singular is already being handled at #15992, this is just
about the suggestion that the anonymous class be declared abstract - it can't be)
### PHP Version
PHP 8.2+
### Operating System
_No response_