Skip to content

[docs] Document class constants in the coding style - #1748

Merged
andrewnicols merged 1 commit into
moodle:mainfrom
safatshahin:codingstyle-class-constants
Nov 9, 2026
Merged

andrewnicols merged 1 commit into
moodle:mainfrom
safatshahin:codingstyle-class-constants

Conversation

@safatshahin

Copy link
Copy Markdown
Collaborator

Documents class constants in the Coding Style and discourages global and
namespaced constants, following the architecture decision on MDLSITE-7040.

  • Constants: new Class constants, Global constants and Namespaced
    constants subsections, with valid and invalid examples. The naming rule
    is unchanged (UPPER_CASE with underscores, per PSR-1).
  • PHPDoc Defines: points new code to class constants.

Deliberately out of scope: adopting PER-3.0, and naming rules for enum
cases. Neither has a tracker decision yet.

Fixes #1666

The Constants section only described global constants declared with
define(). Document class constants as the preferred form, using
UPPER_CASE with underscores in line with PSR-1, and discourage global
and namespaced constants in new code.

Fixes moodle#1666
See MDLSITE-7040
@netlify

netlify Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for moodledevdocs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 03bf0c9
🔍 Latest deploy log https://app.netlify.com/projects/moodledevdocs/deploys/6af166d48ede215758bfd4e8
😎 Deploy Preview https://deploy-preview-1748--moodledevdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@andrewnicols
andrewnicols added this pull request to the merge queue Nov 9, 2026
Merged via the queue into moodle:main with commit 019c788 Nov 9, 2026
8 checks passed
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.

[docs] Coding style: document class constants and discourage global/namespaced constants

2 participants