Class Declaration

The opening brace of an OO structure must be on the line directly after the OO signature. The opening brace must be on a line by itself.

Valid: Opening brace on the correct line.

class Foo <em>{</em> }

Invalid: Opening brace on incorrect line.

class BraceOnSignatureLine <em>{</em> }

class BlankLineBetween <em></em> { }

Valid: Opening brace is on a line by itself.

class Foo <em>{</em> }

Invalid: Opening brace is not on a line by itself.

class Foo {<em> public function __construct() {}</em> }
The opening brace must be indented to the same depth as the OO structure's declaration.

Valid: Opening brace indentation depth matches the OO structure signature's depth.

if (!class_exists('IndentedFourSpaces')) { abstract class IndentedFourSpaces <em>{</em> } }

class NotIndented <em>{</em> }

Invalid: Opening brace indentation depth does not match the OO structure signature's depth.

if (!class_exists('IndentedFourSpaces')) { abstract class IndentedFourSpaces <em>{</em> } }

class NotIndented <em>{</em> }