Apologies if this is a duplicate, I did search for the answer previously.
I'm struggling to overload a method defined in a trait. It throws a fatal error:
Fatal error: Configuration has colliding constructor definitions coming from traits in Configuration.php on line 18
Their Class
<?php
namespace Theirs\Package;
use Theirs\TheirTrait;
class Configration
{
use TheirTrait;
}
My Class
<?php
namespace My\Package;
use Theirs\Package\Configuration as BaseConfiguration;
use My\Trait\MyTrait;
class Configuration extends BaseConfiguration
{
use MyTrait;
}
My Trait
use Theirs\TheirTrait as BaseSomeTrait;
trait MyTrait
{
use BaseSomeTrait;
protected function someMethod($something)
{
// ...
}
}
you can resolve the constructor collision like this.
if MyClass has a constructor as well you need to do it there additionally, or maybe only there if MyTrait has no constructor...