-
Notifications
You must be signed in to change notification settings - Fork 209
Coding Guidelines
ProcessMaker follows the PSR-1 and PSR-12 PHP coding standards. Though we adhere to the entirety of these standards, the most important of these as well as ProcessMaker's own guidelines are summarized below.
For Vue-specific code, we adhere to the Vue Style Guide. More JavaScript coding standards are forthcoming.
-
Shorthand Code (Internal)
- For the sake of readability, shorthand comparisons using ternary operators MUST NOT be used.
-
Files (2.2)
-
All PHP files MUST use the Unix LF (linefeed) line ending only.
-
All PHP files MUST end with a non-blank line, terminated with a single LF.
-
The closing
?>
tag MUST be omitted from files containing only PHP.
-
-
Indenting (2.4)
- Code MUST use an indent of 4 spaces for each indent level, and MUST NOT use tabs for indenting.
-
Using Traits (4.2)
- Each individual trait that is imported into a class MUST be included one-per-line and each inclusion MUST have its own use import statement.
-
Properties and Constants (4.3)
-
Visibility MUST be declared on all properties.
-
Visibility MUST be declared on all constants if your project PHP minimum version supports constant visibilities (PHP 7.1 or later).
-
The
var
keyword MUST NOT be used to declare a property. -
Do not use typed properties on classes as they are only only supported in PHP 7.4 or greater.
-
-
Methods and Functions (4.4)
-
Visibility MUST be declared on all methods.
-
Method names MUST NOT be prefixed with a single underscore to indicate protected or private visibility. That is, an underscore prefix explicitly has no meaning.
-
Method and function names MUST NOT be declared with space after the method name. The opening brace MUST go on its own line, and the closing brace MUST go on the next line following the body. There MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis.
-