Repository navigation
SONARPHP-1969 Account for dynamically accessed local variables - #1855
Conversation
d16192e to
c180a18
Compare
Resolve literal variable names precisely and treat unresolved dynamic reads as possible reads of all locals in their scope. Account for eval, extract, get_defined_vars, and included code that can observe locals. Distinguish static property names from dynamic local lookups in calls, callables, and instance members.
c180a18 to
04f3aad
Compare
|
Code Review ✅ Approved 1 closed / 1 findings🟡 Medium risk · Expanding dynamic-read tracking may suppress unused-local findings for unrelated variables, hiding genuine dead code from PHP analysis. Adds dynamic local variable read tracking so ✅ 1 closed✅ Edge Case: Static method calls with a variable-variable name are skipped as reads
Verification Rules 1/1 met PRs 2 inspectedFunctional validation No results Rules 1 passed 2 not applicable
Broader impact PRs 2 inspectedCross-PR 2 PRs inspected 0 open impactsAuto-approval Not enabledFor more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |




Stack created with GitHub Stacks CLI • Give Feedback 💬
Summary by Gitar
$$name,${'literal'}, and unresolved dynamic reads as reads of locals inReadWriteUsagesinclude,require,eval,extract, andget_defined_varscalls as reading all locals in their scopeUnusedLocalVariableCheckDynamicReads.phpfixture covering dynamic read and write scenariosExample::$$name(), as readsThis will update automatically on new commits.