"php Traits"
As of PHP 5.4.0, PHP implements a method of code reuse called Traits.
1, Traits Foundation
2, Priority: Methods in the current class override the Trait method, and the Trait method overrides the method in the base class.
3, multiple traits, using the use Declaration to list multiple traits.
4. Conflict Resolution: In order to resolve the two Traits naming conflicts in the same class, one of the conflicting methods needs to be explicitly specified using the insteadof operator. Because this allows only one method to be excluded, the as operator can introduce conflicting methods to another name.
5. Modify method Visibility: The class used can adjust the visibility of the method through the AS syntax
6, traits group: Other traits can also use traits, just as classes can use traits. When trait is defined by using one or more trait, it is able to combine some or all of the members of another traits.
7. Abstract members: In order to impose mandatory requirements on the classes used, Trait supports the use of abstract methods.
8, traits static member: Static variable can be referenced by trait method, but cannot be defined by trait. However, traits can define static methods for the classes used.
9. Attribute: If trait defines an attribute, the class will not be able to define properties of the same name, otherwise an error will be generated. If the definition of a class is compatible (the same visibility and initial value) then the level of error E_STRICT
is, otherwise it is a fatal error.
more:http://php.net/manual/en/language.oop5.traits.php
PHP 5.4.0 of traits