Fix PHP import graph paths and trait use detection - #790
Open
jimmybrancaccio wants to merge 2 commits into
Open
jimmybrancaccio wants to merge 2 commits into
jimmybrancaccio wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Normalize Windows paths and handle cross-drive relpath errors before approval.
Review effort: Lite
Findings: 1
What changed in this PR
Fixes dependency-graph matching when PHP discovery returns relative paths while import resolution returns absolute paths.
Changes:
- Adds relative-path fallback matching.
- Adds regression coverage for PHP imports.
| File | Summary |
|---|---|
desloppify/tests/lang/common/test_treesitter_imports_direct.py |
Tests absolute-to-relative PHP import matching. |
desloppify/languages/_framework/treesitter/imports/graph.py |
Adds relative-path matching logic; portability and cross-drive handling remain unresolved. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+86
to
+88
| relative = os.path.relpath(resolved, scan_path) | ||
| if relative not in file_set: | ||
| continue |
github-actions Bot
added a commit
to citizenadam/desloppify
that referenced
this pull request
Sep 27, 2026
github-actions Bot
added a commit
to citizenadam/desloppify
that referenced
this pull request
Sep 27, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
PHP project discovery can return relative file paths, while the PHP import resolver returns absolute paths. The dependency graph then drops valid imports and reports live classes as orphaned. In MyVideoGameList, the scan reported 66 orphaned files, including Stripe gateways explicitly imported in
AppServiceProvider.The PHP import query also matched class trait
usedeclarations as though they were namespace imports. This produced unused-import findings for required traits such asPasswordValidationRules.Fix
Match each resolved import against the discovered path style before discarding it. Add a regression test for an absolute PHP import resolved against relative discovery paths.
Restrict the PHP import query to namespace
usedeclarations and add a regression test showing that an unused namespace import is still reported while a trait use is ignored.Verification
app/tree returned 0 findings; the previous scan reported 6 trait false positives.