From 8a70e4dd303b6b89165986a3cecccde094a71c30 Mon Sep 17 00:00:00 2001 From: Walt Sorensen Date: Sun, 24 Mar 2019 12:14:52 -0600 Subject: [PATCH] Add note on Exclamation mark `!` logical operator (#220) Reference https://github.com/joomla/coding-standards/issues/113 --- manual/php.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/manual/php.md b/manual/php.md index 64bad8de..f2bfb7a4 100644 --- a/manual/php.md +++ b/manual/php.md @@ -45,6 +45,8 @@ For all control structures there is a space between the keyword and an opening p For all all control structures, such as `if`, `else`, `do`, `for`, `foreach`, `try`, `catch`, `switch` and `while`, both the keyword starts a newline and the opening and closing braces are each put on a new line. +Exclamation mark `!`, the logical operator `not` used in a condition, should not have spaces before or after the exclamation mark as shown in the examples. + #### An _if-else_ Example ```php @@ -55,11 +57,14 @@ if ($test) // Comments can go here. // Note that "elseif" as one word is used. - elseif ($test === false) { echo 'Really false'; } +elseif (!$condition) +{ + echo 'Not Condition'; +} else { echo 'A white lie';