mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-31 05:40:24 +02:00
Updated Strings (markdown)
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user