From cf1a84a0a6628085309bf8bb141cbb27b085d5b0 Mon Sep 17 00:00:00 2001 From: LogMANOriginal Date: Mon, 5 Nov 2018 13:15:17 +0100 Subject: [PATCH] Updated String concatenation (markdown) --- String-concatenation.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/String-concatenation.md b/String-concatenation.md index e741794..73fbbfd 100644 --- a/String-concatenation.md +++ b/String-concatenation.md @@ -37,4 +37,26 @@ $text = $greeting
-_Reference_: [`Squiz.Strings.ConcatenationSpacing`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Squiz/Sniffs/Strings/ConcatenationSpacingSniff.php) \ No newline at end of file +_Reference_: [`Squiz.Strings.ConcatenationSpacing`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Squiz/Sniffs/Strings/ConcatenationSpacingSniff.php) + +*** + +While concatenation is useful for combining variables with other variables or static text. It should not be used to combine two sets of static text. See also: [Maximum line length](Maximum-line-length) + +
Example

+ +**Bad** + +```PHP +$text = 'This is' . 'a bad idea!'; +``` + +**Good** + +```PHP +$text = 'This is a good idea!'; +``` + +

+ +_Reference_: [`Generic.Strings.UnnecessaryStringConcat`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Generic/Sniffs/Strings/UnnecessaryStringConcatSniff.php) \ No newline at end of file