I'm trying to run two functions from two separate traits which would be applied within one class but sequentially one adding onto the other. A simple example is shown below
trait UserLevel{
public function get(){
echo 'World';
}
}
trait SpecialUser{
use UserLevel {
UserLevel::get as userGet;
}
public function get(){
echo 'Hello ';
$this->userGet();
}
}
Class GetUser{
use UserLevel, SpecialUser;
}
$user = new GetUser;
$user->get();
All my googling on this issue just show how to use insteadof
to overwrite one with the other.
Edit:
This question isnt a duplicate of the referenced one. On running of the code with the prescribed changes I get
Fatal error: Trait method get has not been applied, because there are collisions with other trait methods on GetUser in /in/hg9ok on line 20
Process exited with code 255.
Thanks