deptrac icon indicating copy to clipboard operation
deptrac copied to clipboard

[WIP] Add ClassMethodResolver to determine return types by Method returns

Open marcelthole opened this issue 3 years ago • 1 comments

a new try to resolve #449 See also #454 as base POC pull request

The following cases are not resolved:

  • [ ] test with multiple return types
  • [ ] return types with @var annotations are not supported
  • [ ] test for array return types

And some other tasks where i'm glad to get some help:

  • [ ] how to resolve the return types by annotations
  • [ ] i use a own variablesCache which doesn't look very good. But i don't know how the variables in the scope are stored.

marcelthole avatar Sep 20 '21 16:09 marcelthole

@marcelthole I had a look at your PR, great work so far! As for the things you are looking for help with:

  • variable cache - I think your solution is absolutely fine, I would not have done any differently
  • resolving types by annotation - I would use already existing AnnotationDependencyResolver. You already have $typeScope passed into your ClassMethodResolver. For $node you would use your methodCall node and for $referenceBuilder you would have to create a new class or reuse FunctionReferenceBuilder and rename it to something akin to FunctionLikeReferenceBuilder.

If you need any more help, feel free to reach out. I have re-written a substantial part of the current AstRunner so I know my way around it.

patrickkusebauch avatar Oct 28 '21 18:10 patrickkusebauch

@marcelthole I am closing this PR as it has had no progress for almost 2 years. Also the solution is more complicated than what is being implemented there, as you can see in the original issue.

patrickkusebauch avatar May 05 '23 20:05 patrickkusebauch