What is the Moodle feature that needs documenting?
https://moodledev.io/general/development/policies/codingstyle#constants
The Constants section of the Moodle Coding Style currently only describes global constants, and both examples use define(). It says nothing about class constants, even though they are the preferred form in modern Moodle code and are explicitly covered by PSR-1 (and therefore by PSR-12 and PER-3.0, which we defer to where MCS is silent).
This leaves three gaps:
- Developers have no documented guidance on class constant naming, and have to infer it from PSR-1.
- The page implies define() is the normal way to declare a constant in new code.
- Namespaced constants are not mentioned at all, despite being permitted by PHP and appearing in PSR examples. They don't support autoloading, and the PSR examples using PascalCase are a common source of confusion (see MDLSITE-7040).
Is this documentation specific to a Moodle version?
None
Are you able to provide a patch for this?
None
What is the Moodle feature that needs documenting?
https://moodledev.io/general/development/policies/codingstyle#constants
The Constants section of the Moodle Coding Style currently only describes global constants, and both examples use define(). It says nothing about class constants, even though they are the preferred form in modern Moodle code and are explicitly covered by PSR-1 (and therefore by PSR-12 and PER-3.0, which we defer to where MCS is silent).
This leaves three gaps:
Is this documentation specific to a Moodle version?
None
Are you able to provide a patch for this?
None