mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-28 22:09:01 +02:00
Created Calling functions (markdown)
parent
c8b9c1cd0c
commit
d13addd88f
1 changed files with 93 additions and 0 deletions
93
Calling-functions.md
Normal file
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)
|
Loading…
Add table
Add a link
Reference in a new issue