I've got main base class:
class BaseClass
{
public function process()
{
echo 'Base::process()';
}
}
and trait:
trait ProtectionTrait
{
public function process()
{
echo 'ProtectionTrait::process()';
}
}
Then I create class extending BaseClass and using ProtectionTrait with changing its process() method name to other:
class ChildClass extends BaseClass
{
use ProtectionTrait {
process as omittedProcess;
}
}
I'd like to bypass ProtectionTrait::process() method by changing its name (like above), but it doesn't seem to work:
$obj = new ChildClass();
$obj->process();
// outputs 'ProtectionTrait::process()'
It is possible to bypass selected method from the trait, so the method of parent class will be invoked? I know I can put the process() method in ChildClass and there invoke parent::process() there manually, but is it possible to do it the other way?