1--TEST-- 2SPL: Test class_uses() function : basic 3--FILE-- 4<?php 5echo "*** Testing class_uses() : basic ***\n"; 6 7 8trait foo { } 9class fooUser { use foo; } 10 11trait bar { } 12class barUser { use bar; } 13 14class foobarUser { use foo, bar; } 15 16/** There is no semantics for traits in the inheritance chain. 17 Traits are flattened into a class, and that semantics is nothing 18 like a type, or interface, and thus, not propergated. */ 19class fooViaBarUser extends barUser { use foo; } 20 21class fooExtended extends fooUser {} 22 23s_var_dump(class_uses(new foobarUser)); 24s_var_dump(class_uses('foobarUser')); 25s_var_dump(class_uses(new fooViaBarUser)); 26s_var_dump(class_uses('fooViaBarUser')); 27s_var_dump(class_uses(new fooExtended)); 28s_var_dump(class_uses('fooExtended')); 29 30 31function s_var_dump($arr) { 32 krsort($arr); 33 var_dump($arr); 34} 35?> 36--EXPECT-- 37*** Testing class_uses() : basic *** 38array(2) { 39 ["foo"]=> 40 string(3) "foo" 41 ["bar"]=> 42 string(3) "bar" 43} 44array(2) { 45 ["foo"]=> 46 string(3) "foo" 47 ["bar"]=> 48 string(3) "bar" 49} 50array(1) { 51 ["foo"]=> 52 string(3) "foo" 53} 54array(1) { 55 ["foo"]=> 56 string(3) "foo" 57} 58array(0) { 59} 60array(0) { 61} 62