diff --git a/standards/general.md b/standards/general.md index 6fe76f7..e70c904 100644 --- a/standards/general.md +++ b/standards/general.md @@ -118,6 +118,19 @@ if (...) { $result = condition ? expr1 : expr2; ``` +Multiline `if` statements must begin with a logical opperator `or`/`and`. + +```php +if (isTrue == true + || isFalse === false + && isNotTrue !== true +) { + +} +``` + +Switch statements must have a `default` case. + ## Constants Constants must be written with capital letters and snake case. diff --git a/standards/php.md b/standards/php.md index ba721ae..a72d6df 100644 --- a/standards/php.md +++ b/standards/php.md @@ -10,6 +10,14 @@ PHP code MUST use the long `` tags or the short-echo `= ?>` tags; it M PHP code MUST use only UTF-8 without BOM +## Line Ending + +Lines MUST end with `\n` (LF) and MUST NOT have a whitespace at the end. + +## File Ending + +Files must end with a new line element `\n`. + ## Namespace and Class Names Namespaces and classes MUST follow an "autoloading" PSR: [PSR-0, PSR-4]. @@ -23,7 +31,7 @@ Class names MUST be declared in StudlyCaps. Php code embedded into template files SHOULD use the alternative syntax for control structures in order to improve the readability: ```php -if($a === 5) : ?> +
This is html
``` @@ -36,6 +44,16 @@ when echoing multiple components, don't concat them but use `,`. echo 'Hello' , 'World'; ``` +## If + +#### Elseif + +Use `elseif` where possible instead of `else if`. + +## Namespace + +Namespaces must be surrounded with new line elements. + ## Deprecated functions and variables The following functions and (super-) global variables MUST NOT be used.