Edit report at https://bugs.php.net/bug.php?id=61554&edit=1
ID: 61554 User updated by: afredmyers at gmail dot com Reported by: afredmyers at gmail dot com Summary: ReflectionClass::getTraits does not return inherited traits Status: Open -Type: Documentation Problem +Type: Bug Package: Reflection related Operating System: Ubuntu 11.10 PHP Version: 5.4.0 Block user comment: N Private report: N New Comment: whoops, changed bug type from "Documentation Type" to "Bug" Previous Comments: ------------------------------------------------------------------------ [2012-03-29 16:52:34] afredmyers at gmail dot com Description: ------------ --- >From manual page: >http://www.php.net/reflectionclass.gettraits#refsect1-reflectionclass.gettraits-returnvalues --- ReflectionClass::getTraits() does not return traits inherited from ancestor classes. Test script: --------------- trait Balding { public function loseHair(){ echo get_class($this) . " is losing his hair!\n\n"; } } class Father { use Balding; } class Son extends Father {} $Son = new Son; $Son->loseHair(); $Reflect = new ReflectionClass($Son); print_r($Reflect->getTraits()); Expected result: ---------------- Son is losing his hair! Array ( [Balding] => ReflectionClass Object ( [name] => Balding ) ) Actual result: -------------- Son is losing his hair! Array ( ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61554&edit=1