-
-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add traits and don't import their methods #89
Conversation
Actually, this is a much more complicated task. PHP doesn't have sufficient API to detect if a method is defined in the trait ( class Aliased_Talker {
use A, B {
B::smallTalk insteadof A;
A::bigTalk insteadof B;
B::bigTalk as talk;
}
} I'll add switch whether to import traits or not, and leave it up to the user, because it's hard to do it perfectly. |
@dg Yeah, it's a tough one. The only flaw I observed in my code is that it still imports static properties from the traits. I couldn't really figure out a way around that, yet. But the static properties are easy to delete and at least it doesn't import a million trait functions. Thanks for adding that option for me and for your amazing work and generosity on this project! :D |
That's odd, I tried adding a test to it and the static variables seem to work correctly: |
Previously the factory wasn't importing used traits from existing classes