Trait method %s::%s has not been applied as %s::%s
Description
Two methods with the same name were imported with two distinct traits: PHP could not decide which one to use.
Example
<?php
trait T {
public function foo() { return 3; }
}
trait U {
public function foo() { return 2; }
}
class Bar {
use T, U;
}
$x = new Bar();
var_dump($x->foo());
?>
Literal Examples
- Trait method U::foo has not been applied as Bar::foo, because of collision with T::foo
Alternatives
- Change the name of the method in one of the trait.
- Add aliasing when importing the traits.
- Only use one of the trait.
- Make one trait use the other one.