This repository has been archived by the owner on Jan 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Dev CodingGuidelines Statements
Frank Kleine edited this page Apr 7, 2012
·
1 revision
On declarations of classes and methods parenthesis are to be set as follows:
class Foo { public function bar($foo) { ... } }
Method parameters should contain type hints as far as possible.
Sequence of modificators is as follows:
abstract class Foo { public static final function staticMethod() { ... } protected abstract function doSomething(); }
On function/method calls there is no space between the function/method name, the opening parenthesis and the first parameter. Function/method parameters are separated with a space:
$string = str_replace($foo, $bar);
If possible single quotes (') should be used. Complex string concatenations are done with breakage of string and using the string concatenation operator:
$foo = 'foo' . $bar;Left and right to the string concatenation operator must be a space.
Usage of include(_once)/require(_once) in class files is discouraged. The class loader should be used instead.
include(_once)/require(_once) are no functions, this means no parenthesis must be used:
require_once 'XML/Serializer.php'; include_once 'Foo.php';
Next: Namespaces