Skip to content

Core framework code style

samdark edited this page Aug 9, 2012 · 17 revisions
  1. Overview

  • Files MUST use only <?php tags.
  • Files MUST use only UTF-8 without BOM for PHP code.
  • Class names MUST be declared in StudlyCaps.
  • Class constants MUST be declared in all upper case with underscore separators.
  • Method names MUST be declared in camelCase.
  1. Files

2.1. PHP Tags

PHP code MUST use the long <?php ?> tags; it MUST NOT use the other tag variations.

2.2. Character Encoding

PHP code MUST use only UTF-8 without BOM.

  1. Class Names

Class names MUST be declared in StudlyCaps.

  1. Class Constants, Properties, and Methods

The term "class" refers to all classes and interfaces here.

4.1. Constants

Class constants MUST be declared in all upper case with underscore separators. For example:

<?php
class Foo
{
    const VERSION = '1.0';
    const DATE_APPROVED = '2012-06-01';
}

4.2. Methods

Method names MUST be declared in camelCase().

Clone this wiki locally