mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[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
This commit is contained in:
parent
e7cc707931
commit
d8ff43c080
1 changed files with 20 additions and 0 deletions
|
@ -696,6 +696,26 @@ switch ($mode)
|
||||||
}
|
}
|
||||||
</pre></div>
|
</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>
|
<a name="sql"></a><h3>2.iii. SQL/SQL Layout</h3>
|
||||||
|
|
||||||
<h4>Common SQL Guidelines: </h4>
|
<h4>Common SQL Guidelines: </h4>
|
||||||
|
|
Loading…
Add table
Reference in a new issue