__CLASS__ will return the name of the class in which the trait is being used (!) not the class in which trait method is being called:

__CLASS__will return the name of the class in which the trait is being used (!) not the class in which trait method is being called:



testMethod();

//Class: BaseClass
//Trait: TestTrait


你可能感兴趣的:(__CLASS__ will return the name of the class in which the trait is being used (!) not the class in which trait method is being called:)