Skip to content

Commit 88c642d

Browse files
committed
Merge pull request joomla#65 from MrBenGriffin/patch-1
Update inline-comments.md
2 parents a76f109 + 1a996a0 commit 88c642d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

manual/en-US/coding-standards/chapters/inline-comments.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@ Comments should precede the code they refer to. As a corollary, comments should
1616

1717
Don’t use a blank line between comments and the code they refer to (no space underneath a comment block).
1818

19-
Always have a single blank line before a comment or block of comments.
19+
Always have a single blank line before a comment or block of comments unless the comment (or block) is at the beginning of a code structure. ( You should not have a blank line after a '{' line )
20+
21+
For example in the following case there is no new line before the first comment (because it follows a '{' line) but we do want a new line before the second comment:
22+
23+
```php
24+
while (!$done)
25+
{
26+
// We don't want an infinite loop here.
27+
$done = true;
28+
}
29+
30+
//Now let's do something interesting.
31+
$result = somethingInteresting();
32+
```
2033

2134
Comments should align with the code they refer to, using the same indenting as the line that follows the comment.
2235

0 commit comments

Comments
 (0)