I know that Yii 2 is aimed at php 5.3. The short array syntax introduced in php 5.4 is only cosmetic,
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?
What’s the point? Just use [“short array” => “syntax”] in your application code and don’t worry about what syntax Yii uses.
Yeah, you’re right. We wait for Yii3 which will have PHP6 as a requirement. Year 2016 maybe?
Oh and we will pronounce it 3ii !
I thinks you are missing the point phpnode is making. If you are using php5.4 in your server, you can easily replace all YOUR files with [syntax] instead of array(syntax) leaving the framework files untouched. Internally everything will work just as usual.
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]);
As @zen pointed above… if you use PHP 5.4 you can do that in your code… without changing anything in the Yii core.