using short array syntax BUT stick to php 5.3
Posted 21 March 2012 - 09:27 AM
but since Yii in general has borrowed so many cool things from ruby on rails, i just CAN´T live with this
ugly array(''=>array(... constructs anymore.
Since the array short syntax is nothing more than replacing all array( with [ and the corresponding ) with ],
there could be a one-liner script converting the yii 2.0 codebase recursively into short-array-syntax. Would
this be possible or am i missing something?
Posted 22 March 2012 - 05:26 PM
Posted 22 March 2012 - 05:30 PM
Posted 19 May 2012 - 11:28 AM
It makes your scripts easier to read and prettier.. Especially in Yii, where about anything is done in arrays, it would be an improvement. A big advantage is that using square brackets, you can distinguish between method calls and arrays. For example, compare:
$this->render('product/overview', array('model' => $model, 'dataProvider' => $dataProvider));
$this->render('product/overview', ['model' => $model, 'dataProvider' => $dataProvider]);