oop - PHP Trait conflict when class implements interface -


i have class implements interface execute method.

the interface forces execute method have 2 arguments type hints.

also i'm using trait has execute method, different functionality , signature. alter trait method name using :

class myclass implements myinterface {     use mytrait     {       execute protected commanderexecute;    }     public function execute(someinterface $arg1, someinterface2 $arg2)    {        //    }  } 

when try run app throws fatal error exception following message:

trait method commanderexecute has not been applied, because there collisions other trait methods on ...

try this:

class myclass implements myinterface {      use mytrait      {         mytrait::execute protected commanderexecute;     }      public function execute(someinterface $arg1, someinterface2 $arg2)     {         //     }  } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -