Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Dev CodingGuidelines Statements

Frank Kleine edited this page Apr 7, 2012 · 1 revision

Table of Contents

Developer pages: Coding Guidelines

Statements

Class and method declarations

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();
}

Function/method calls

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);

Strings

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.

include(_once)/require(_once)

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



---
Back to developer pages

Clone this wiki locally