Uploaded image for project: 'Moodle Community Sites'
  1. Moodle Community Sites
  2. MDLSITE-4122

Coding style does not demand frankenstyle prefix for class names



    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: Coding style
    • Labels:


      The section https://docs.moodle.org/dev/Coding_style#Classes does not clearly states that class names should start with the frankenstyle prefix. We have it declared explicitly for global functions and constants, but not for classes. I believe this has always been unwritten rule and the coding style page should be improved to reflect that.

      We are seeing crazy class names sometimes in submitted plugins with a high chance for collision with a core subsystem and/or other plugin. Not having the rule documented in the coding style page explicitly makes it harder to raise it as a suggestion for improvements.

      The https://docs.moodle.org/dev/Plugin_contribution_checklist states it like

      Check that all your DB tables, settings, functions, classes, constants and variables are named correctly. Do not define own classes, functions, variables or constants in the global PHP scope without the valid frankenstyle prefix.

      Basically, the Coding style should state it clearly that either the class must be properly namespaced (as documented below) or use the valid frankenstyle prefix.




            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: