From d13addd88f0231945d4607f7c9719ef1d920e4e8 Mon Sep 17 00:00:00 2001 From: LogMANOriginal Date: Mon, 5 Nov 2018 13:11:34 +0100 Subject: [PATCH] Created Calling functions (markdown) --- Calling-functions.md | 93 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Calling-functions.md 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