Closed
Description
Description
The following code:
<?php
$c = new class {
abstract public function f();
};
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/7aall on line 3
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/7aall on line 3
Process exited with code 255.
Similar issue if the abstract method comes from a trait or an inherited class.
(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+