Skip to content

Add sniff detecting deprecated $CFG properties. - #233

Open
paulholden wants to merge 1 commit into
moodlehq:mainfrom
paulholden:MDLSITE-6012
Open

paulholden wants to merge 1 commit into
moodlehq:mainfrom
paulholden:MDLSITE-6012

Conversation

@paulholden

Copy link
Copy Markdown
Member

Adds a new moodle.PHP.DeprecatedCFGProperties sniff that warns on any use of removed-but-aliased $CFG properties. Ships with an entry for $CFG->httpswwwroot (removed in Moodle 3.4, still aliased for BC), suggesting $CFG->wwwroot as the replacement.

Detects both bare-code accesses and references inside double-quoted strings / heredocs, and only fires when the variable is exactly $CFG.

Adds a new moodle.PHP.DeprecatedCFGProperties sniff that warns on any
use of removed-but-aliased $CFG properties. Ships with an entry for
$CFG->httpswwwroot (removed in Moodle 3.4, still aliased for BC),
suggesting $CFG->wwwroot as the replacement.

Detects both bare-code accesses and references inside double-quoted
strings / heredocs, and only fires when the variable is exactly $CFG.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.09%. Comparing base (b60df78) to head (318caac).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
moodle/Sniffs/PHP/DeprecatedCFGPropertiesSniff.php 83.33% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #233      +/-   ##
============================================
- Coverage     98.27%   98.09%   -0.18%     
- Complexity      994     1008      +14     
============================================
  Files            42       43       +1     
  Lines          2961     2997      +36     
============================================
+ Hits           2910     2940      +30     
- Misses           51       57       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant