Skip to content

Tracking method used? #1

Description

@ondrejmirtes

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 :)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions