| Class Name | MyClassName |
|---|---|
| Function/Method |
myMethodName |
| Function/Method Argument |
$my_argument |
| Private/Protected Class Variables |
$my_private_variable |
| Public Class Variable/Property |
$MyPublicVariable |
| Class/Global Constants |
MY_CONSTANT_NAME |
| class MyAwesomeClass extends MyOtherAwesomeClass { const MY_CONST = 1; public $MyPublicVariable; private $my_private_variable; public function myPublicMethod($do_it) { if ($do_it) { $this->my_private_variable = 0; } } private function myPrivateMethod() { // Do stuff } } |
| YES |
| if ($something) doSomething(); while ($something) doSomething(); if ($something) { doSomething(); } |
| NO |
| // Put these on the same line, or use parenthesis to make it clear. while ($something) doSomething(); // This is the incorrect brace style. while ($something) { doSomething(); } // This is messy. Use more lines. while ($something) { doSomething(); doSomethingElse(); } |
| YES |
| class MyClass { private $my_var; public function myMethod() { } public static function myStaticMethod($my_argument) { // Do stuff } } |
| NO |
| class MyClass { function myMethod() { } } |
| class MyClass { public function myMethod(DB_Database_1 $database) { } } |