Description
Hi,
I've been intrigued by finding this library because I'm facing a similar challenge in PHPStan. I'd like to know what method do you use to track file dependencies?
I've only been able to find this directory in your source code: https://github.com/BackEndTea/Dependency-Finder/tree/master/src/PHPParser/Visitor So I think that you only use Name
AST node ocurrences as dependencies.
But this problem is far more complex. Consider for example this scenario:
You have a class A that has property private $bProperty
with injected class B. You call method doB
on $this->bProperty
that returns C. Now you call some method on the C
object.
Now you're in a situation that class A
depends on changes in class C
but AFAIK your tool is not able to track this.
PHPStan solves this thanks to type inference - it knows about types of all expressions so it's able to reason about method calls, read phpDocs etc. The logic itself to find out about dependencies is in this class: https://github.com/phpstan/phpstan/blob/master/src/Dependency/DependencyResolver.php
Let me know if you want to work together on this problem :)