summaryrefslogtreecommitdiff
path: root/CODING_STANDARDS
diff options
context:
space:
mode:
authorJon Parise <jon@php.net>2000-11-26 21:45:44 +0000
committerJon Parise <jon@php.net>2000-11-26 21:45:44 +0000
commit45807e6dd997147f5de89b5d2d2fcddd3815fd1e (patch)
treed121be75633b327fa167240965aaf0adc2b13aac /CODING_STANDARDS
parentdca467faf377b2fb56525b1dc1055f3081ea2c74 (diff)
downloadphp-git-45807e6dd997147f5de89b5d2d2fcddd3815fd1e.tar.gz
Added a brief section documenting the preference of tabs over spaces.
There are a few touch-ups in this commit, too.
Diffstat (limited to 'CODING_STANDARDS')
-rw-r--r--CODING_STANDARDS22
1 files changed, 15 insertions, 7 deletions
diff --git a/CODING_STANDARDS b/CODING_STANDARDS
index 5e4a7b7ae6..550b730a95 100644
--- a/CODING_STANDARDS
+++ b/CODING_STANDARDS
@@ -5,8 +5,9 @@ PHP Coding Standards
This file lists several standards that any programmer, adding or changing
code in PHP, should follow. Since this file was added at a very late
stage of the development of PHP v3.0, the code base does not (yet) fully
-follow it, but it's going in that general direction. Since we are now
-at version 4.0.3, many sections have been recoded to use these rules.
+follow it, but it's going in that general direction. Since we are now
+well into the version 4 releases, many sections have been recoded to use
+these rules.
Code Implementation
@@ -109,25 +110,32 @@ Syntax and indentation
is known to accept C++-style comments in C code.
[2] Use K&R-style. Of course, we can't and don't want to
- force anybody to use a style she's not used to, but
+ force anybody to use a style he or she is not used to, but,
at the very least, when you write code that goes into the core
of PHP or one of its standard modules, please maintain the K&R
style. This applies to just about everything, starting with
indentation and comment styles and up to function decleration
syntax.
-[3] Be generous with whitespace and braces. Always prefer
- if (foo) {
+[3] Be generous with whitespace and braces. Always prefer:
+
+ if (foo) {
bar;
}
- to
+
+ to:
+
if(foo)bar;
-
+
Keep one empty line between the variable decleration section and
the statements in a block, as well as between logical statement
groups in a block. Maintain at least one empty line between
two functions, preferably two.
+[4] When indenting, use the tab character. A tab is expected to represent
+ four spaces. It is important to maintain consistency in indenture so
+ that definitions, comments, and control structures line up correctly.
+
Documentation and Folding Hooks
-------------------------------