mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-06 10:55:14 +02:00
Updated Coding style policy (markdown)
parent
f221811e5d
commit
df3b21e9d5
1 changed files with 37 additions and 6 deletions
|
@ -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.
|
The concatenation operator should have one space on both sides in order to improve readability.
|
||||||
|
|
||||||
|
<details><summary>Example</summary><div><br>
|
||||||
|
|
||||||
<rule ref="Squiz.Strings.ConcatenationSpacing">
|
**Bad**
|
||||||
<properties>
|
|
||||||
<property name="spacing" value="1"/>
|
```PHP
|
||||||
<property name="ignoreNewlines" value="true"/>
|
$text = $greeting.' '.$name.'!';
|
||||||
</properties>
|
```
|
||||||
</rule>
|
|
||||||
|
**Good** (add spaces)
|
||||||
|
|
||||||
|
```PHP
|
||||||
|
$text = $greeting . ' ' . $name . '!';
|
||||||
|
```
|
||||||
|
|
||||||
|
</div></details><br>
|
||||||
|
|
||||||
|
You may break long lines into multiple lines using the concatenation operator. That way readability can improve considerable when combining lots of variables.
|
||||||
|
|
||||||
|
<details><summary>Example</summary><div><br>
|
||||||
|
|
||||||
|
**Bad**
|
||||||
|
|
||||||
|
```PHP
|
||||||
|
$text = $greeting.' '.$name.'!';
|
||||||
|
```
|
||||||
|
|
||||||
|
**Good** (split into multiple lines)
|
||||||
|
|
||||||
|
```PHP
|
||||||
|
$text = $greeting
|
||||||
|
. ' '
|
||||||
|
. $name
|
||||||
|
. '!';
|
||||||
|
```
|
||||||
|
|
||||||
|
</div></details><br>
|
||||||
|
|
||||||
|
_Reference_: [`Squiz.Strings.ConcatenationSpacing`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Squiz/Sniffs/Strings/ConcatenationSpacingSniff.php)
|
||||||
|
|
||||||
# Maximum line length
|
# Maximum line length
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue