Explain 'Trait' conflict resolution. What happens if two traits used in the same class have the same method name?
Last updated
If two traits in the same class define the same method name, PHP raises a fatal error unless you resolve it in the
useblock.insteadofpicks which trait's method wins.asaliases the other method to a new name and can also change its visibility.Precedence: a method defined in the class overrides a trait method, and a trait method overrides an inherited parent method.