From df3b21e9d56f4894efb04ee5949842b717cf1e8f Mon Sep 17 00:00:00 2001 From: LogMANOriginal Date: Mon, 5 Nov 2018 13:05:13 +0100 Subject: [PATCH] Updated Coding style policy (markdown) --- Coding-style-policy.md | 43 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/Coding-style-policy.md b/Coding-style-policy.md index 15aba2f..054ff2c 100644 --- a/Coding-style-policy.md +++ b/Coding-style-policy.md @@ -19,13 +19,44 @@ _Reference_: [`Generic.WhiteSpace.DisallowSpaceIndent`](https://github.com/squiz The concatenation operator should have one space on both sides in order to improve readability. +
Example

- - - - - - +**Bad** + +```PHP +$text = $greeting.' '.$name.'!'; +``` + +**Good** (add spaces) + +```PHP +$text = $greeting . ' ' . $name . '!'; +``` + +

+ +You may break long lines into multiple lines using the concatenation operator. That way readability can improve considerable when combining lots of variables. + +
Example

+ +**Bad** + +```PHP +$text = $greeting.' '.$name.'!'; +``` + +**Good** (split into multiple lines) + +```PHP +$text = $greeting +. ' ' +. $name +. '!'; +``` + +

+ +_Reference_: [`Squiz.Strings.ConcatenationSpacing`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Squiz/Sniffs/Strings/ConcatenationSpacingSniff.php) # Maximum line length