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 for file, function and superglobal tokens #634

Merged
merged 36 commits into from
Jul 20, 2021
Merged

Support for file, function and superglobal tokens #634

merged 36 commits into from
Jul 20, 2021

Conversation

patrickkusebauch
Copy link
Collaborator

@patrickkusebauch patrickkusebauch commented Jul 14, 2021

Task-list:

  • Visitor refactor
  • Emitters refactor
  • Collectors for new features (like functions and superglobals)
  • Layers resolution
  • docs
  • tests

In a separate PRs, I would suggest the following:

  • either changing or adding new debug commands (debug:class is kind of meaningless right now)
  • tracking custom function calls (might be difficult to differentiate from internal functions)

Closes: #331
Closes: #473
Closes: #582
Closes: #594

@patrickkusebauch patrickkusebauch marked this pull request as draft July 17, 2021 21:10
@patrickkusebauch patrickkusebauch changed the title WIP: AST Runner parsing Support for file, function and superglobal tokens Jul 17, 2021
@patrickkusebauch patrickkusebauch marked this pull request as ready for review July 17, 2021 22:31
config/services.php Outdated Show resolved Hide resolved
docs/collectors.md Outdated Show resolved Hide resolved
src/AstRunner/AstMap/AstDependency.php Show resolved Hide resolved
src/AstRunner/AstMap/ClassLikeName.php Show resolved Hide resolved
@MGatner
Copy link

MGatner commented Jul 19, 2021

Tons of work! I don't understand all of the changes but I'm excited for the high-level concepts. Thank you!!

@dbrumann
Copy link
Collaborator

Thanks a lot, @patrickkusebauch. I like the direction this is taking. Happy to merge this 👍

Comment on lines +46 to +52
- `class` (default) - analyzes class definitions for everything apart from superglobal usage.
- `class_superglobal` - analyzes class definitions for superglobal usage.
- `use` (default) - analyzes file definitions for use statements.
- `file` - analyzes file for everything apart from use statements and function/class definitions.
- `function` - analyzes function definitions for everything apart from superglobal usage.
- `function_superglobal` - analyzes function definitions for superglobal usage.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am wondering about this paragraph.. doesn't it mean is only possible to scan for superglobals within functions or classes, but not in plain php files?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, no. See https://github.com/qossmic/deptrac/blob/main/tests/DependencyEmitter/FileDependencyEmitterTest.php#L37. I recall that I differentiated class_superglobal as not to break current behavior.

function_superglobal - I am not that sure about it. I think function support was implemented in a previous commit, so the same reasoning? I don't recall honestly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants