<?php
trait MyTrait
{
final protected function someMethod(): void {}
}
class Test
{
use MyTrait {
someMethod as private anotherMethod;
}
public function __construct()
{
$this->anotherMethod();
}
}
new Test;
Warning: Private methods cannot be final as they are never overridden by other classes in /in/YtW3h on line 8
Output for 7.0.0 - 7.0.33
Fatal error: Uncaught TypeError: Return value of Test::someMethod() must be an instance of void, none returned in /in/YtW3h:5
Stack trace:
#0 /in/YtW3h(16): Test->anotherMethod()
#1 /in/YtW3h(20): Test->__construct()
#2 {main}
thrown in /in/YtW3h on line 5
Process exited with code 255.