Hi Markus,

Am Mittwoch, den 20.02.2008, 12:13 +0100 schrieb Markus Fischer:
[...]
> generally asking, how would Reflection act on traits? Can this be 
> detected or will the information be lost after a class has been 
> assembled? E.g. detect if a certain method comes from a trait and which one?

Good question. The current patch does not include anything about
reflections. But as the information about traits is present in the
struct zend_class_entry is is possible to expose trait information via
the reflection API. I would propose something like this:

class ReflectionTrait:
 * getMethods(): array[ReflectionMethod]
 * ... pretty similiar to ReflectionClass

extending class ReflectionClass:
 * getTraits(): array[ReflectionTrait]
 * usesTraits(): bool

extending class ReflectionMethod:
 * flattened(): bool
 * getTrait(): ReflectionTrait

Maybe ReflectionMethod::flattened() should be
ReflectionMethod::belongsToTrait() or something like this, I'm not sure
here.

cu, Lars

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to