mantisbt:coding_guidelines
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mantisbt:coding_guidelines [2014/02/13 21:57] – Note about CSS table-container. samwilson | mantisbt:coding_guidelines [2025/01/11 10:16] (current) – [Coding Guidelines] fallback to PHP-FIG PER Coding Style 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:// | + | If something is not defined in this document, then please apply the rules in PHP-FIG' |
| + | |||
| + | Please discuss any omissions or disagreements on our [[https:// | ||
| ===== 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: | * Indentations: | ||
| * PHP tags: always use ''<? | * PHP tags: always use ''<? | ||
| Line 25: | Line 29: | ||
| ===== Code Blocks ===== | ===== Code Blocks ===== | ||
| + | |||
| ==== Braces and Parentheses ==== | ==== Braces and Parentheses ==== | ||
| Line 34: | Line 39: | ||
| * No space before the opening parentheses '' | * No space before the opening parentheses '' | ||
| * One space after the opening '' | * One space after the opening '' | ||
| + | * Arrays elements should be referenced without spaces, e.g. '' | ||
| Example:< | Example:< | ||
| Line 84: | Line 90: | ||
| ==== Switch statements ==== | ==== Switch statements ==== | ||
| + | |||
| + | Every case //must// have a '' | ||
| <code php> | <code php> | ||
| Line 92: | Line 100: | ||
| case 2: | case 2: | ||
| blah; | blah; | ||
| - | # Fall through | + | # Fall through |
| - | case 3: | + | case 3: # No need for a break here |
| case 4: | case 4: | ||
| blah; | blah; | ||
| - | | + | |
| default: | default: | ||
| blah; | blah; | ||
mantisbt/coding_guidelines.1392346662.txt.gz · Last modified: (external edit)
