-
Most important: Look around. Match the style you see used in the rest of the project. This includes formatting, naming things in code, naming things in documentation.
-
Code MUST use 4 spaces for indenting, not tabs.
-
There MUST NOT be a hard limit on line length; the soft limit MUST be 120 characters; lines SHOULD be 80 characters or less.
-
There MUST be one blank line after the
namespacedeclaration, and there MUST be one blank line after the block ofusedeclarations. -
Opening braces for classes MUST go on the next line, and closing braces MUST go on the next line after the body.
-
Opening braces for methods MUST go on the next line, and closing braces MUST go on the next line after the body.
-
Blank lines MAY be added to improve readability and to indicate related blocks of code.
-
The PHP constants
true,false, andnullMUST be in lower case. -
Prefer
'over"