You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
432 B
43 lines
432 B
13 years ago
|
Yii2 core code style
|
||
|
====================
|
||
|
|
||
|
### Brackets
|
||
|
|
||
|
~~~
|
||
|
class MyClass
|
||
|
{
|
||
|
public function myClassMethod()
|
||
|
{
|
||
|
if($x)
|
||
|
{
|
||
|
// do it
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
// some code
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
~~~
|
||
|
|
||
|
|
||
|
Proposals
|
||
|
---------
|
||
|
|
||
|
### Use type hinting like
|
||
|
|
||
|
~~~
|
||
|
public function __construct(CDbConnection $connection)
|
||
|
{
|
||
|
$this->connection = $connection;
|
||
|
}
|
||
|
~~~
|
||
|
|
||
|
instead of
|
||
|
|
||
|
~~~
|
||
|
public function __construct($connection)
|
||
|
{
|
||
|
$this->connection = $connection;
|
||
|
}
|
||
|
~~~
|