Closed
Description
Description
The following code:
<?php
trait MyTrait
{
final protected function someMethod(): void {}
}
class Test
{
use MyTrait {
someMethod as private anotherMethod;
}
public function __construct()
{
$this->anotherMethod();
}
}
Resulted in this output:
Warning: Private methods cannot be final as they are never overridden by other classes in /in/YtW3h on line 8
But I expected this output instead:
No error
PHP Version
8.3.14 and 8.4.1
Operating System
No response