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
ClassReflection: make getTraits recursive #557
Conversation
This change needs a test. |
@ondrejmirtes should In terms of tests needed: a test for the traits returned by |
Nope, that's only used in About the test for this PR - I'd like to have a new file in You can obtain
|
@ondrejmirtes I've discovered that trait BazTrait
{
}
class Baz
{
use BazTrait;
}
class BazChild extends Baz
{
}
Is this indended behavior? I noticed that if I change it to also include parent traits recursively, the following tests fail: What is your take on this? For the Larastan use case, there is a function needed that just returns all traits for a class (and all of the parents). |
This is probably a sign we should care about backward compatibility more (when it even breaks PHPStan internals). So I suggest this:
|
What about adding a |
This is just a temporary measure, I'll do something cleaner in 1.0. |
Thank you! |
Changes the
ClassReflection::getTraits
function to be recursive according to the suggestion from @ondrejmirtes at larastan/larastan#837 (comment)