we have a small pseudocode scenario in our project:
trait headFunction {
protected function doStuffWithParam($param){
return $param;
}
}
trait extA {
use headFunction;
protected function doExtAStuff($param){
...
return $this->doStuffWithParam($param);
}
}
trait extB {
use headFunction;
protected function doExtBStuff($param){
...
return $this->doStuffWithParam($param);
}
}
class classUsingTraits(){
use extA, extB;
...
}
But there is collision:
Trait method doStuffWithParam has not been applied, because there are collisions with other trait methods on test in....
Unfortunately traits has no extend option.
How to avoid problem with collision without moving headFunction to classUsingTraits - is there any soloution? We looks in PHP documentation, but there is soloution only for 2 traits - we have traits like this about 10+-.. and we cannot use it.
Is there any way how to solve this?
Thanks you for help!