Skip to content
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

Fixed interface plugin linemarker #328

Merged
merged 10 commits into from
Oct 28, 2020

Conversation

drpayyne
Copy link
Contributor

@drpayyne drpayyne commented Oct 21, 2020

Description

This PR fixes the missing linemarker for plugins to interface methods

Fixed Issues

  1. Plugin linemarkers is missing for interface methods #322: Plugin linemarkers is missing for interface methods

Questions or comments

I have a proposed solution, but if anyone has a better solution, please do let me know. I shall improve it.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with integration/functional tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@drpayyne
Copy link
Contributor Author

Please check the first commit in this PR (ref: a17b6a3) to find my proposed solution. The other commit adds too many static test fixes.

Also, I was thinking if the below code would be a better approach than the one in the above commit. This code would get both classes and interfaces, for the given FQN, instead of just getting interfaces only if classes returned empty. Is there a case where the below code would be required? Just bouncing off ideas, thanks.

for (String targetClassName : targetClassNames) {
    Collection<PhpClass> targets = phpIndex.getClassesByFQN(targetClassName);
    targets.addAll(phpIndex.getInterfacesByFQN(targetClassName));
    results.addAll(targets);
}

@drpayyne
Copy link
Contributor Author

This PR edits a single line of a file where there are 10s of pre-existing static test failures. I shall fix those failures once my suggested approach is confirmed by a reviewer. Thanks!

@VitaliyBoyko
Copy link
Contributor

@drpayyne I'm fine with the solution. Please proceed.

@drpayyne
Copy link
Contributor Author

Hi @VitaliyBoyko, could you please advise on how I can fix the remaining static test failures? I'm not sure what's the good approach.

/home/runner/work/magento2-phpstorm-plugin/magento2-phpstorm-plugin/src/com/magento/idea/magento2plugin/linemarker/php/PluginTargetLineMarkerProvider.java:79:	Avoid using implementation types like 'HashMap'; use the interface instead

/home/runner/work/magento2-phpstorm-plugin/magento2-phpstorm-plugin/src/com/magento/idea/magento2plugin/linemarker/php/PluginTargetLineMarkerProvider.java:132:	To avoid mistakes add a comment at the beginning of the TargetClassesCollector constructor if you want a default access modifier

/home/runner/work/magento2-phpstorm-plugin/magento2-phpstorm-plugin/src/com/magento/idea/magento2plugin/linemarker/php/PluginTargetLineMarkerProvider.java:147:	To avoid mistakes add a comment at the beginning of the TargetMethodsCollector constructor if you want a default access modifier

Copy link
Contributor

@VitaliyBoyko VitaliyBoyko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA passed ✅

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants