User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


mantisbt:coding_guidelines

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mantisbt:coding_guidelines [2014/06/03 05:44] – Added indication for array elements [] dregadmantisbt:coding_guidelines [2018/04/03 05:50] (current) – [Coding Guidelines] fix broken link to mailing lists page (#24212) dregad
Line 8: Line 8:
 The rest of this page describes in which ways we differ, as well as other Mantis-specific guidelines. The rest of this page describes in which ways we differ, as well as other Mantis-specific guidelines.
  
-Please discuss any omissions or disagreements on the [[http://mantisbt.org/mailinglists.php|Developers Mailing List]].+Please discuss any omissions or disagreements on our [[https://gitter.im/mantisbt/mantisbt|Gitter]] chat room, or in the [[http://mantisbt.org/forums|Forums]]. 
  
  
 ===== General Formatting ===== ===== General Formatting =====
  
 +  * Line length: should generally be kept below **80 chars**, although it is acceptable to have lines up to 120 chars when necessary.
   * Indentations: use TABS with a size of 4 (not spaces)   * Indentations: use TABS with a size of 4 (not spaces)
   * PHP tags: always use ''<?php'' and ''?>'', never ''<? ?>'' or ''<?= ?>''.   * PHP tags: always use ''<?php'' and ''?>'', never ''<? ?>'' or ''<?= ?>''.
Line 86: Line 88:
  
 ==== Switch statements ==== ==== Switch statements ====
 +
 +Every case //must// have a ''break'' or another kind of exit statement, e.g. ''return'', ''die'', etc. If falling through to the following case is intended, it must be documented, unless the case does not contain any code. The ''break'' is not necessary for the final, default case.
  
 <code php> <code php>
Line 94: Line 98:
     case 2:     case 2:
         blah;         blah;
-        # Fall through should be commented +        # Fall through must be commented 
-    case 3:+    case 3:        # No need for a break here
     case 4:     case 4:
         blah;         blah;
-        break;+        return   # No need for a break here
     default:     default:
         blah;         blah;
mantisbt/coding_guidelines.1401788676.txt.gz · Last modified: 2014/09/16 05:07 (external edit)

Driven by DokuWiki