This repository was archived by the owner on Apr 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Coding Standards
Burak Çakırel edited this page Jan 21, 2016
·
2 revisions
When contributing code to Arastta, you must follow its coding standards. Here is the golden rule: Imitate the existing Arastta code.
Arastta tries to adhere the coding standards defined in the PSR-1 and PSR-2 documents. Except the following ones due to not brake OC extensions compatibility:
- PSR-1: Namespace and Class Names
- PSR-1: Side Effects
- PSR-2: Lines
Also, here is the file for PhpStorm: Arastta.xml Copy the file to:
- Mac
~/Library/Preferences/WebIdeXX/config/codestyles/Arastta.xml
- Windows
<User home>\.WebIdeXX\config\codestyles\Arastta.xml
- Linux
~/.WebIdeXX/config/codestyles/Arastta.xml
Additionally, here is the other coding standards for Arastta:
- Indentation
- File naming
- Helper naming
- PHP variable naming
- User defined constants
- PHP constants
- HTML / CSS rules
### Indentation All files(PHP, TPL, JS, CSS, JSON, SQL) must be indented using the 4 space tabs. TAB character are not supported.
### File naming All files should be in lower case and words separated by an underscore.
### PHP Function (helpers) naming Helper function names should be lower case and an underscore used to separate words.
### PHP variable naming PHP variables should be lower case and an underscore used to separate words (snake_case).
$var = 123;
$new_var = 12345;
$Var = 123;
$newVar = 12345;
### User defined constants User defined constants are set as upper case.
define('MY_VAR', 'My constant string value');
define('my_var', 'My constant string value');
### PHP constants These types of constant (true,false,null) are set as lower case
$my_var = true;
$my_var = TRUE;
### HTML / CSS rules Class names and id's should be hyphenated and not use an underscore
class="my-class"
class="my_class"