I have a few aliased traits in PHP like so:
class Foo {
use Bar, Other {
Bar as One;
Bar as Two;
Other as Three;
}
}
Is there a way to get a list of the currently used traits and their aliased names for that class? I know PHP has class_uses(), but that only returns Bar and Other not One, Two or Three in the example above. I'd like to have a key => value of the Original name and the aliased name. Anyone happen to know how? I've done a lot of googling with no results.
Looks like you can use ReflectionClass to get this. Specifically the getTraitAliases method:
http://php.net/manual/en/reflectionclass.gettraitaliases.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With