mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-12-19 01:20:58 +03:00
Updated Strings (markdown)
parent
1b4523000e
commit
5372621305
1 changed files with 4 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue