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

Support inherited static functions #679

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

letynsoft
Copy link

When the resolveScopedPropertyAccessExpressionNodeToFqn cannot find the definition, try it the extended class

@letynsoft
Copy link
Author

Hmm, from the tests it really doesn't like that, but from the functionality it works nice :-(
Is there any way to do this only when this is request from the editor?
They doesn't seem to be added for a right reason in the tests...

@codecov
Copy link

codecov bot commented Oct 28, 2018

Codecov Report

Merging #679 into master will increase coverage by 0.1%.
The diff coverage is 100%.

@@             Coverage Diff             @@
##             master     #679     +/-   ##
===========================================
+ Coverage     82.17%   82.27%   +0.1%     
- Complexity      935      940      +5     
===========================================
  Files            44       44             
  Lines          2154     2167     +13     
===========================================
+ Hits           1770     1783     +13     
  Misses          384      384
Impacted Files Coverage Δ Complexity Δ
src/DefinitionResolver.php 87.73% <100%> (+0.27%) 337 <0> (+5) ⬆️

@felixfbecker
Copy link
Owner

Could you explain what this PR fixes? What do you mean with parent contexts?

@letynsoft
Copy link
Author

letynsoft commented Oct 31, 2018

eg.

class a {
  static function a () { ... }
}
class b extends a {
}

and then when you call b::a() the language server is able to find the method then (same as PHP does)

@felixfbecker felixfbecker changed the title ci: Add ability to find documentation for static functions defined in parent contexts Support inherited static functions Nov 11, 2018
$name = (string)$className . '::$' . $memberName;
} else {
$name = (string)$className . '::' . $scoped->memberName->getText($scoped->getFileContents());
}
Copy link
Owner

Choose a reason for hiding this comment

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

There is a lot of logic here that does not change on each loop iteration, such as the instanceof checks above and the member name. Could you save this in variables and move it out of the loop?

@felixfbecker
Copy link
Owner

Also, could you add a test?

@letynsoft
Copy link
Author

letynsoft commented Dec 22, 2018

Hi,
The standard TestClass method and variable finds the reference to the call/access, so i think that is what i can test there :)

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.

2 participants