1--TEST-- 2__TRAIT__: Basics, a constant denoiting the trait of definition. 3--FILE-- 4<?php 5 6trait TestTrait { 7 public static function test() { 8 return __TRAIT__; 9 } 10} 11 12class Direct { 13 use TestTrait; 14} 15 16class IndirectInheritance extends Direct { 17 18} 19 20trait TestTraitIndirect { 21 use TestTrait; 22} 23 24class Indirect { 25 use TestTraitIndirect; 26} 27 28echo Direct::test()."\n"; 29echo IndirectInheritance::test()."\n"; 30echo Indirect::test()."\n"; 31 32?> 33--EXPECT-- 34TestTrait 35TestTrait 36TestTrait 37