<?php
trait FooTrait {
public function foo() {
echo('qwer');
}
}
class Foo2 {
use FooTrait;
public function foo() {
parent::foo();
echo('asdf');
}
}
$foo = new Foo2();
$foo->foo();
Fatal error: Cannot use "parent" when current class scope has no parent in /in/QOPX1 on line 10
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Deprecated: Cannot use "parent" when current class scope has no parent in /in/QOPX1 on line 10
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/QOPX1:10
Stack trace:
#0 /in/QOPX1(15): Foo2->foo()
#1 {main}
thrown in /in/QOPX1 on line 10
Process exited with code 255.
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/QOPX1:10
Stack trace:
#0 /in/QOPX1(15): Foo2->foo()
#1 {main}
thrown in /in/QOPX1 on line 10
Process exited with code 255.