Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added a brief section documenting the preference of tabs over spaces.

There are a few touch-ups in this commit, too.
  • Loading branch information...
commit 45807e6dd997147f5de89b5d2d2fcddd3815fd1e 1 parent dca467f
Jon Parise jparise authored

Showing 1 changed file with 15 additions and 7 deletions. Show diff stats Hide diff stats

  1. +15 7 CODING_STANDARDS
22 CODING_STANDARDS
@@ -5,8 +5,9 @@ PHP Coding Standards
5 5 This file lists several standards that any programmer, adding or changing
6 6 code in PHP, should follow. Since this file was added at a very late
7 7 stage of the development of PHP v3.0, the code base does not (yet) fully
8   -follow it, but it's going in that general direction. Since we are now
9   -at version 4.0.3, many sections have been recoded to use these rules.
  8 +follow it, but it's going in that general direction. Since we are now
  9 +well into the version 4 releases, many sections have been recoded to use
  10 +these rules.
10 11
11 12
12 13 Code Implementation
@@ -109,25 +110,32 @@ Syntax and indentation
109 110 is known to accept C++-style comments in C code.
110 111
111 112 [2] Use K&R-style. Of course, we can't and don't want to
112   - force anybody to use a style she's not used to, but
  113 + force anybody to use a style he or she is not used to, but,
113 114 at the very least, when you write code that goes into the core
114 115 of PHP or one of its standard modules, please maintain the K&R
115 116 style. This applies to just about everything, starting with
116 117 indentation and comment styles and up to function decleration
117 118 syntax.
118 119
119   -[3] Be generous with whitespace and braces. Always prefer
120   - if (foo) {
  120 +[3] Be generous with whitespace and braces. Always prefer:
  121 +
  122 + if (foo) {
121 123 bar;
122 124 }
123   - to
  125 +
  126 + to:
  127 +
124 128 if(foo)bar;
125   -
  129 +
126 130 Keep one empty line between the variable decleration section and
127 131 the statements in a block, as well as between logical statement
128 132 groups in a block. Maintain at least one empty line between
129 133 two functions, preferably two.
130 134
  135 +[4] When indenting, use the tab character. A tab is expected to represent
  136 + four spaces. It is important to maintain consistency in indenture so
  137 + that definitions, comments, and control structures line up correctly.
  138 +
131 139 Documentation and Folding Hooks
132 140 -------------------------------
133 141

0 comments on commit 45807e6

Please sign in to comment.
Something went wrong with that request. Please try again.