1--TEST-- 2Test get_declared_traits() function : testing autoloaded traits 3--FILE-- 4<?php 5echo "*** Testing get_declared_traits() : testing autoloaded traits ***\n"; 6 7spl_autoload_register(function ($trait_name) { 8 require_once $trait_name . '.inc'; 9}); 10 11echo "\n-- before instance is declared --\n"; 12var_dump(in_array('AutoTrait', get_declared_traits())); 13 14echo "\n-- after use is declared --\n"; 15 16class MyClass { 17 use AutoTrait; 18} 19 20var_dump(in_array('AutoTrait', get_declared_traits())); 21 22echo "\nDONE\n"; 23 24?> 25--EXPECT-- 26*** Testing get_declared_traits() : testing autoloaded traits *** 27 28-- before instance is declared -- 29bool(false) 30 31-- after use is declared -- 32bool(true) 33 34DONE 35