Skip to content

Commit 8bba316

Browse files
committed
feature #4457 [RFC] Clarification on formatting for bangs (!) (bryanagee)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #4457). Discussion ---------- [RFC] Clarification on formatting for bangs (!) It seems to me that > Add a single space around operators would mean using the practice on the bang operator as well; as discussed in [this thread](https://github.com/php-fig/fig-standards/issues/102), there is somewhat of a conflict--so this may not be the way to go. If the PSR could be amended, then this change would make sense. Commits ------- ee888c6 Fixes concat operator typo 33e76a5 Incorporates @wouterj 's suggestion for more realistic usage of bang 837e895 Changes operator spacing language 835d5eb Adds missing space before return statement 3799bc0 Fixes spelling and formatting errors 30d19ab Fixes wrong bullet character 3212b6c Adds bullet addressing bang placement 95a1cc5 Reverses statement about bang spacing and corresponding examples a68d3e5 [RFC] Clarification on formatting for bangs (!)
2 parents 0a9c146 + ee888c6 commit 8bba316

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

contributing/code/standards.rst

+13-1
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,26 @@ example containing most features described below:
7979

8080
throw new \RuntimeException(sprintf('Unrecognized dummy option "%s"', $dummy));
8181
}
82+
83+
private function reverseBoolean($value = null, $theSwitch = false)
84+
{
85+
if (!$theSwitch) {
86+
return;
87+
}
88+
89+
return !$value;
90+
}
8291
}
8392

8493
Structure
8594
---------
8695

8796
* Add a single space after each comma delimiter;
8897

89-
* Add a single space around operators (``==``, ``&&``, ...);
98+
* Add a single space around binary operators (``==``, ``&&``, ...), with
99+
the exception of the concatenation (``.``) operator;
100+
101+
* Place unary operators (``!``, ``--``, ...) adjacent to the affected variable;
90102

91103
* Add a comma after each array item in a multi-line array, even after the
92104
last one;

0 commit comments

Comments
 (0)