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
Post a Comment