Updated Strings (markdown)

LogMANOriginal 2018-11-05 13:24:12 +01:00
parent 1b4523000e
commit 5372621305

@ -1,3 +1,5 @@
# Whenever possible use single quote strings
PHP supports both single quote strings and double quote strings. For pure text you must use single quote strings for consistency. Double quote strings are only allowed for special characters (i.e. `"\n"`) or inlined variables (i.e. `"My name is {$name}"`);
<details><summary>Example</summary><div><br>
@ -18,7 +20,7 @@ echo 'Hello World!';
_Reference_: [`Squiz.Strings.DoubleQuoteUsage`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Squiz/Sniffs/Strings/DoubleQuoteUsageSniff.php)
***
# Add spaces around the concatenation operator
The concatenation operator should have one space on both sides in order to improve readability.
@ -61,7 +63,7 @@ $text = $greeting
_Reference_: [`Squiz.Strings.ConcatenationSpacing`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Squiz/Sniffs/Strings/ConcatenationSpacingSniff.php)
***
# Use a single string instead of concatenating
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)