aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-07-04 16:16:13 +0200
committerNils Adermann <naderman@naderman.de>2010-07-04 16:16:13 +0200
commitd8ff43c080d4f9d097f74b51f329f86ba83499f6 (patch)
treeecc23110c09742325e6ea52ddab9f377a3bfdf6b
parente7cc707931518e98f06a804471ccce4f33f6773f (diff)
downloadforums-d8ff43c080d4f9d097f74b51f329f86ba83499f6.tar
forums-d8ff43c080d4f9d097f74b51f329f86ba83499f6.tar.gz
forums-d8ff43c080d4f9d097f74b51f329f86ba83499f6.tar.bz2
forums-d8ff43c080d4f9d097f74b51f329f86ba83499f6.tar.xz
forums-d8ff43c080d4f9d097f74b51f329f86ba83499f6.zip
[task/coding-guidelines] Class member qualifier guidelines
Use private, protected or public instead of var. Use static public instead of public static. Use class constants instead of define(). PHPBB3-9557
-rw-r--r--phpBB/docs/coding-guidelines.html20
1 files changed, 20 insertions, 0 deletions
diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
index e34e1d9929..f340b671cc 100644
--- a/phpBB/docs/coding-guidelines.html
+++ b/phpBB/docs/coding-guidelines.html
@@ -696,6 +696,26 @@ switch ($mode)
}
</pre></div>
+ <h4>Class Members</h4>
+ <p>Use the explicit visibility qualifiers <code>public</code>, <code>private</code> and <code>protected</code> for all properties instead of <code>var</code>.
+
+ <p>Place the <code>static</code> qualifier before the visibility qualifiers.</p>
+
+ <p class="bad">//Wrong </p>
+ <div class="codebox"><pre>
+var $x;
+private static function f()
+ </pre></div>
+
+ <p class="good">// Right </p>
+ <div class="codebox"><pre>
+public $x;
+static private function f()
+ </pre></div>
+
+ <h4>Constants</h4>
+ <p>Prefer class constants over global constants created with <code>define()</code>.</p>
+
<a name="sql"></a><h3>2.iii. SQL/SQL Layout</h3>
<h4>Common SQL Guidelines: </h4>