diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 3f2c142ac6..fbec59a6ff 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -397,7 +397,7 @@ for ($i = 0; $i < size; $i++)

Where to put the braces:

-

This one is a bit of a holy war, but we're going to use a style that can be summed up in one sentence: Braces always go on their own line. The closing brace should also always be at the same column as the corresponding opening brace, examples:

+

In PHP code, braces always go on their own line. The closing brace should also always be at the same column as the corresponding opening brace, examples:

 if (condition)
@@ -427,6 +427,30 @@ function do_stuff()
 	...
 }
 	
+ +

In JavaScript code, braces always go on the same line:

+ +
+if (condition) {
+	while (condition2) {
+		...
+	}
+} else {
+	...
+}
+
+for (var i = 0; i < size; i++) {
+	...
+}
+
+while (condition) {
+	...
+}
+
+function do_stuff() {
+	...
+}
+	

Use spaces between tokens:

This is another simple, easy step that helps keep code readable without much effort. Whenever you write an assignment, expression, etc.. Always leave one space between the tokens. Basically, write code as if it was English. Put spaces between variable names and operators. Don't put spaces just after an opening bracket or before a closing bracket. Don't put spaces just before a comma or a semicolon. This is best shown with a few examples, examples: