-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Core framework code style
creocoder edited this page Aug 9, 2012
·
23 revisions
- Overview
- Files MUST use only
<?phptags. - Files MUST use only UTF-8 without BOM for PHP code.
- Code MUST use tabs for indenting, not spaces.
- 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. - Property names MUST be declared in
camelCase - Property names MUST start with an initial underscore if they are private.
- Files
PHP code MUST use the long <?php ?> tags; it
MUST NOT use the other tag variations.
PHP code MUST use only UTF-8 without BOM.
- Class Names
Class names MUST be declared in StudlyCaps.
- Class Constants, Properties, and Methods
The term "class" refers to all classes and interfaces here.
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';
}
Property names MUST be declared in camelCase.
Property names MUST start with an initial underscore if they are private.
For example:
<?php
class Foo
{
public $publicProp;
protected $protectedProp;
private $_privateProp;
}
Method names MUST be declared in camelCase().