diff options
author | Callum Macrae <callum@lynxphp.com> | 2012-04-29 19:07:48 +0100 |
---|---|---|
committer | Callum Macrae <callum@lynxphp.com> | 2012-04-29 19:07:48 +0100 |
commit | 3978e2620ea3ad50f80bc273542ff9dc830743fd (patch) | |
tree | cf6bf36b2fc3ec1a199f08075714ef09cc78315c /phpBB/docs | |
parent | 2a92fee06d22eb54ee9373adca1c3b50b1d3e3d7 (diff) | |
download | forums-3978e2620ea3ad50f80bc273542ff9dc830743fd.tar forums-3978e2620ea3ad50f80bc273542ff9dc830743fd.tar.gz forums-3978e2620ea3ad50f80bc273542ff9dc830743fd.tar.bz2 forums-3978e2620ea3ad50f80bc273542ff9dc830743fd.tar.xz forums-3978e2620ea3ad50f80bc273542ff9dc830743fd.zip |
[ticket/10855] Modified coding guidelines to reflect JS brace changes.
Braces always go on the same line in JavaScript.
PHPBB3-10855
Diffstat (limited to 'phpBB/docs')
-rw-r--r-- | phpBB/docs/coding-guidelines.html | 26 |
1 files changed, 25 insertions, 1 deletions
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++) </pre></div> <h4>Where to put the braces:</h4> - <p>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:</p> + <p>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:</p> <div class="codebox"><pre> if (condition) @@ -427,6 +427,30 @@ function do_stuff() ... } </pre></div> + + <p>In JavaScript code, braces always go on the same line:</p> + + <div class="codebox"><pre> +if (condition) { + while (condition2) { + ... + } +} else { + ... +} + +for (var i = 0; i < size; i++) { + ... +} + +while (condition) { + ... +} + +function do_stuff() { + ... +} + </pre></div> <h4>Use spaces between tokens:</h4> <p>This is another simple, easy step that helps keep code readable without much effort. Whenever you write an assignment, expression, etc.. Always leave <em>one</em> 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:</p> |