-
Notifications
You must be signed in to change notification settings - Fork 17
Allow use of the $GLOBALS superglobal #218
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
Conversation
2239fda to
66f09b2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #218 +/- ##
=========================================
Coverage 98.27% 98.27%
Complexity 994 994
=========================================
Files 42 42
Lines 2961 2961
=========================================
Hits 2910 2910
Misses 51 51 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Use of global variables in general is something I typically discourage these days. There's not much discussion here, so I'm guessing it happened in another forum. My question: Is $GLOBALS being added here for backward compatibility with existing code? Or are we saying that $GLOBALS is unconditionally allowed by Moodle Coding standards? Personally, I would recommend temporarily allowing, but discouraging the use of $GLOBALS because access to these values is already available from the |
|
Hi @jrchamp, Yes, we do discourage its use, but it is still in use in a few places and automatically fixing it will break things, so we to allow it. |
|
Perfect! Thank you for confirming. |
|
Worth noting: the sniff says nothing about whether you should use |
|
@cameron1729 Excellent point! 🧠 In that sense, this sniff should include all of the special variables from both PHP itself and Moodle core. I can't begin to thank you for highlighting that note. ❤️ As far as discouraging use, I agree that seems that would be a different Sniff. Perhaps something new like |
|
No worries @jrchamp - happy to help :) I think a new sniff makes sense too. Maybe part of the moodle-extra coding style. |
No description provided.