On 07 May 2010, at 10:34, Sebastian Bergmann wrote: > On 05/06/2010 06:05 PM, Felipe Pena wrote: >> I guess better to create a traits-specific class. Currently the >> ReflectionClass doesn't return information about traits. > > I do not see a need for Trait-specific reflection because of the > flattening property ("compiler-assisted copy&paste"). Well, the question would be more like do we want to expose that information in the reflection. At the moment it would certainly be possible. The information is there. I would considered it an optimization to drop it after it is not 'needed' anymore. But, instead of dropping it, it would also be possible to extend ReflectionClass to expose it.
I would be in favor of exposing it. From a conceptual perspective it would be good to have a ReflectionTrait and ReflectionClass should have something like ReflectionClass::getTraits(). However, when it comes to methods, we have ReflectionMethod::getDeclaringClass() which also could return the corresponding trait. From an implementation perspective Traits are classes at the moment. So, well, for the reflection it would be the easiest to follow that approach, but it would not make things more clear to people trying to understand the differences. Writing up a proposal for a reflection api is definitely on my todo list, but I am not sure when I will be able to actually do it. Best regards Stefan > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php