Http://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP
Assignment as expression to look like a mistake
// No if $a = foo ()) { bar ();}
// Yes $a = foo (); if $a ) { bar ();}
To improve code readability, MediaWiki uses a large number of spaces
Binary operators
// No $a=$b+$c// Yes$a$b$c;
The function name is followed by parentheses, and if there are parameters in parentheses, spaces are added to both sides.
// Yes $a $b ); $c = Getbar ();
Control structure if and for foreach switch, keyword catch, followed by spaces
// Yes if (Isfoo ()) { $a = ' foo '// Noif(Isfoo ()) { $a = ' foo ';}
Forcing type conversions
// Yes (int) $foo // No$bar;(int)$bar$bar;
Comments
// yes:proper inline comment//no:missing space
Ternary operators
Unless the expression is short, use if. Remember that everything is for code readability.
"If" is 中文版;?: Is not.
PHP Coding conventions for MediaWiki.org