-
Notifications
You must be signed in to change notification settings - Fork 136
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
Fix 758 #778
Fix 758 #778
Conversation
105f687
to
4daf071
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks good to me. Do you think you can write a test case for this?
{ | ||
$dependencyFQDN = $dependency->getTokenName()->toString(); | ||
|
||
foreach ($astMap->getAstClassReferences() as $class) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to do a same type of for each loop for functions here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, nice catch :)
Yes I'll add tests :) Specifically the only issue I can foresee with this approach is considering that |
73ed043
to
b8e34ee
Compare
{ | ||
$dependencyFQDN = $dependency->getTokenName()->toString(); | ||
|
||
$functionReferences = array_merge(...array_values(array_map( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way to get all function references from AstMap
? There is a list of function references in AstMap
but no getter exposes it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need at and there is no nice way to get it, just add the getter. :)
b543e16
to
87c3bfb
Compare
Tests added :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you again. Great work 👍
Hello, thank You for this tool and your contribution! I just want to share performance results on my project before and after this PR. Before:
After:
How do you think, is it possible to optimize the algorythm? |
Fixes #758.
Prevent namespaces from being added to use dependencies. Namespaces are
detected by looking if the used FQDN is a prefix of some class FQDN.
This strategy may be a bit brittle, I'll let you judge if this good enough or if the current behavior is better.