Code Monkey home page Code Monkey logo

Comments (4)

mihaeu avatar mihaeu commented on May 26, 2024

from dephpend.

brightbyte avatar brightbyte commented on May 26, 2024

Hi mihaeu, I'm glad you agree that this is would be a helpful feature!
I may be able to help with implementing this. This functionality would help me a lot!

from dephpend.

mihaeu avatar mihaeu commented on May 26, 2024

Well, help is always appreciated :)

I have a long flight today, so I have some time to work on all your ideas :)

But dePHPend's architecture is quite simple actually.

All selected PHP files are parsed and then analyzed. After that, you've got a map of dependency tuples. Prefilters are run on every command and reduce that map depending on which filter was used (mostly selectors like regex etc.). Post processors are passed as callables depending on the command because those change how dependencies are displayed (e.g. you cannot strip classes from a namespace before counting how many classes are in a namespace, even though afterward you're only interested in the namespace).

Long story short what needs to happen for detecting visibility:

  • add the property to the Dependency value object
  • extend the src/Analyser/DependencyInspectionVisitor.php to add this information when encountering a property node
  • adjust output accordingly (probably best done by implementing a post-processor option --scope or --visibility)

Similarly, if you want to track deprecated methods you want to extend the inspector and (in this case) write a prefilter for it.

This might actually be a point where it could make sense to split up the inspector and inject which visitors are supposed to be used. It was mostly a performance and laziness decision to not do that in the first place. It might be worth benchmarking if the DependencyInspector can be split up into separate visitors, but honestly, I'm fine with the mess in there ... maybe one day I'll get around to fixing that.

from dephpend.

mihaeu avatar mihaeu commented on May 26, 2024

I still see this as a very interesting feature, but also one that requires keeping track of state and doing multiple passes over all dependencies.

I'm guessing you already solved this issue, since it's 2 years old now 🙉 but if there's still a need, feel free to re-open, and I'll try to help in some way or another.

from dephpend.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.