1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-04 23:57:29 +02:00

Created Calling functions (markdown)

LogMANOriginal
2018-11-05 13:11:34 +01:00
parent c8b9c1cd0c
commit d13addd88f

93
Calling-functions.md Normal file

@@ -0,0 +1,93 @@
Function calls must follow a few rules in order to maintain readability throughout the project:
**Do not add whitespace before the opening parenthesis**
<details><summary>Example</summary><div><br>
**Bad**
```PHP
$result = my_function ($param);
```
**Good**
```PHP
$result = my_function($param);
```
</div></details><br>
**Do not add whitespace after the opening parenthesis**
<details><summary>Example</summary><div><br>
**Bad**
```PHP
$result = my_function( $param);
```
**Good**
```PHP
$result = my_function($param);
```
</div></details><br>
**Do not add a space before the closing parenthesis**
<details><summary>Example</summary><div><br>
**Bad**
```PHP
$result = my_function($param );
```
**Good**
```PHP
$result = my_function($param);
```
</div></details><br>
**Do not add a space before a comma**
<details><summary>Example</summary><div><br>
**Bad**
```PHP
$result = my_function($param1 ,$param2);
```
**Good**
```PHP
$result = my_function($param1, $param2);
```
</div></details><br>
**Add a space after a comma**
<details><summary>Example</summary><div><br>
**Bad**
```PHP
$result = my_function($param1,$param2);
```
**Good**
```PHP
$result = my_function($param1, $param2);
```
</div></details><br>
_Reference_: [`Generic.Functions.FunctionCallArgumentSpacing`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Generic/Sniffs/Functions/FunctionCallArgumentSpacingSniff.php)