Reflection, Traits, Aliasing
| From: | Johannes Schlüter | Date: | Mon, 25 Jul 2011 17:21:49 +0000 |
| Subject: | Reflection, Traits, Aliasing | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-54190@lists.php.net to get a copy of this message | ||
Stefan,
I recently tried to finalize reflection support for traits. Given code
like
<?php
trait T1 {
public function t1() {}
public function ta() {}
}
trait T2 {
public function t1() {}
public function tb() {}
}
class C {
use T1, T2 {
T2::t1 insteadof T1;
T1::t1 as tc;
}
}
?>
Now I use reflection on this:
$rc = new ReflectionClass('C');
print_r($rc->getTraitAliases());
Array
(
[tc] => T1::t1
)
So far so nice but I'm missing the information where C::t1() is coming
from. In the reflection code I'm currently iterating over
ce->trait_aliases and can't find where I can get the information from.
Actually I'd be even interested in getting all important methods and
their origin. Stefan, do you know where I can find the information or
would we have to store it additionally?
johannes