diff --git a/Calling-functions.md b/Calling-functions.md new file mode 100644 index 0000000..cbcc058 --- /dev/null +++ b/Calling-functions.md @@ -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** + +
Example

+ +**Bad** + +```PHP +$result = my_function ($param); +``` + +**Good** + +```PHP +$result = my_function($param); +``` + +

+ +**Do not add whitespace after the opening parenthesis** + +
Example

+ +**Bad** + +```PHP +$result = my_function( $param); +``` + +**Good** + +```PHP +$result = my_function($param); +``` + +

+ +**Do not add a space before the closing parenthesis** + +
Example

+ +**Bad** + +```PHP +$result = my_function($param ); +``` + +**Good** + +```PHP +$result = my_function($param); +``` + +

+ +**Do not add a space before a comma** + +
Example

+ +**Bad** + +```PHP +$result = my_function($param1 ,$param2); +``` + +**Good** + +```PHP +$result = my_function($param1, $param2); +``` + +

+ +**Add a space after a comma** + +
Example

+ +**Bad** + +```PHP +$result = my_function($param1,$param2); +``` + +**Good** + +```PHP +$result = my_function($param1, $param2); +``` + +

+ +_Reference_: [`Generic.Functions.FunctionCallArgumentSpacing`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Generic/Sniffs/Functions/FunctionCallArgumentSpacingSniff.php) \ No newline at end of file