Re: RFC: Traits for PHP / Reflection
| From: | Lars Strojny | Date: | Wed, 20 Feb 2008 11:36:56 +0000 |
| Subject: | Re: RFC: Traits for PHP / Reflection | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35651@lists.php.net to get a copy of this message | ||
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: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc
Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc