Import PHP include and require targets - #875
Open
yzxcj797 wants to merge 1 commit into
Open
Conversation
code-review-graph reviewOverall risk: 0.30 (LOW) — 5 changed function(s)/class(es), 0 affected flow(s), 2 test gap(s) Risk-scored changes
Test gaps
Token savings: this graph-backed report used ~163,666 fewer tokens (~99%) than reading every changed file in full (estimated, chars/4 approximation). Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
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.
Summary
PHP
usedeclarations produced import edges, but procedural PHP files wired together withinclude,include_once,require, andrequire_oncehad noIMPORTS_FROMedges. Impact radius and importer queries therefore saw no cross-file structure for non-Composer codebases.The parser now treats all four include/require expression forms as import nodes, extracts their string argument, and resolves relative paths ending in
.phpwithout appending a second extension.Fixes #819.
Testing
require_once 'includes/conexao.php';include_once 'helper.php'.mainwith zero import edges and pass with the fix.pytest tests/test_pr819_php_includes.py -q— 2 passedpytest tests/test_php_scoped_calls.py tests/test_php_laravel.py tests/test_pr819_php_includes.py -q— 56 passed, 2 skipped, plus one pre-existing Windows path-separator assertion unchanged by this patchruff checkon changed files — passesgit diff --check— passes