You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generic/OpeningFunctionBraceKernighanRitchie: improve XML documentation (#927)
* Generic/OpeningFunctionBraceKernighanRitchie: fix syntax errors in the XML doc code examples
* Generic/OpeningFunctionBraceKernighanRitchie: improve XML doc
- `<documentation>` title matches the sniff name.
- Don't mention the Kernighan/Ritchie style in the `<standard>`
description as according to Wikipedia this style uses the opening brace
for functions on a separate line and not on the same line (https://en
.wikipedia.org/wiki/Indentation_style#K&R).
- I believe it is more precise to say that the sniff checks if the
opening brace is on the same line as the closing parenthesis and not the
function declaration as the function declaration can be multi-line.
- Mention in the `<standard>` description that there must be no content
on the line after the opening brace.
- Improve the title of the `<code>` blocks.
Copy file name to clipboardExpand all lines: src/Standards/Generic/Docs/Functions/OpeningFunctionBraceKernighanRitchieStandard.xml
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,24 @@
1
-
<documentationtitle="Opening Brace in Function Declarations">
1
+
<documentationtitle="Opening Function Brace Kerninghan Ritchie">
2
2
<standard>
3
3
<![CDATA[
4
-
Function declarations follow the "Kernighan/Ritchie style". The function brace is on the same line as the function declaration. One space is required between the closing parenthesis and the brace.
4
+
The function opening brace must be on the same line as the end of the function declaration, with
5
+
exactly one space between the end of the declaration and the brace. The brace must be the last
6
+
content on the line.
5
7
]]>
6
8
</standard>
7
9
<code_comparison>
8
-
<codetitle="Valid: Brace on same line.">
10
+
<codetitle="Valid: Opening brace on the same line.">
9
11
<![CDATA[
10
12
function fooFunction($arg1, $arg2 = '')<em> {</em>
11
-
...
13
+
// Do something.
12
14
}
13
15
]]>
14
16
</code>
15
-
<codetitle="Invalid: Brace on next line.">
17
+
<codetitle="Invalid: Opening brace on the next line.">
0 commit comments