Browse Source

more todos, code style

tags/2.0.0-beta
Alexander Makarov 13 years ago
parent
commit
e3cb887cb2
  1. 54
      docs/code_style.md
  2. 3
      todo.md

54
docs/code_style.md

@ -1,9 +1,37 @@
Yii2 core code style
====================
Yii2 code standard
==================
This code standard is used for all the Yii2 core classes and can be applied to
your application in order to achieve consistency among your team. Also it will
help in case you want to opensource code.
PHP file formatting
-------------------
### General
- Do not use `?>` for files containing PHP code only.
- Files should be encoded in UTF-8.
### Indentation
All major PHP frameworks and libraries are using spaces. Common number is four:
- Symfony 2: four spaces
- Zend Framework 1: four spaces
- Zend Framework 2: four spaces
- Pear: four spaces
### Maximum Line Length
We're not strictly limiting maximum line length but sticking to 80 characters
where possible.
### Line Termination
Proposals
---------
### Brackets
@ -46,4 +74,20 @@ public function __construct($connection)
{
$this->connection = $connection;
}
~~~
~~~
### Other library and framework standards
It's good to be consistent with other frameworks and libraries whose components
will be possibly used with Yii2. That's why when there are no objective reasons
to use different style we should use one that's common among most of the popular
libraries and frameworks.
That's not only about PHP but about JavaScript as well. Since we're using jQuery
a lot it's better to be consistent with its style as well.
- [Symfony 2](http://symfony.com/doc/current/contributing/code/standards.html)
- [Zend Framework 1](http://framework.zend.com/manual/en/coding-standard.coding-style.html)
- [Zend Framework 2](http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards)
- [Pear](http://pear.php.net/manual/en/standards.php)
- [jQuery](http://docs.jquery.com/JQuery_Core_Style_Guidelines)

3
todo.md

@ -13,7 +13,8 @@
* type conversion rules
* CompareValidator::clientValidateAttribute(): search for "CHtml::activeId"
* FileValidator, UniqueValidator, ExistValidator, DateValidator: TBD
* consider merging UniqueValidator and ExistValidator and using a NOT property.
* consider merging UniqueValidator and ExistValidator and using a NOT property: array('!exist', …)
* when getting errors from getErrors it will be good to have which validator (at least type) failed exactly.
- console command support [DONE]
- built-in console commands
+ api doc builder

Loading…
Cancel
Save