You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[docs] Coding style: document class constants and discourage global/namespaced constants #1666
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?
Activity