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?
Page 1 of 1
using short array syntax BUT stick to php 5.3
#2
Posted 21 March 2012 - 09:58 AM
What's the point? Just use ["short array" => "syntax"] in your application code and don't worry about what syntax Yii uses.
#3
Posted 21 March 2012 - 12:52 PM
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 !
Oh and we will pronounce it 3ii !
#4
Posted 22 March 2012 - 05:26 PM
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.
#5
Posted 22 March 2012 - 05:30 PM
I don't get the point of this, its not like javascript where every character counts. It also adds no performance boost. Out of this I like the fact array dereferencing has been added more than anything.
See my development site @ www.CodeTheInter.net (BETA)


Quote
If you make it idiot proof, they'll build a better idiot
#6
Posted 19 May 2012 - 11:28 AM
Jaggi, on 22 March 2012 - 05:30 PM, said:
I don't get the point of this, its not like javascript where every character counts. It also adds no performance boost. Out of this I like the fact array dereferencing has been added more than anything.
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]);
#7
Posted 20 May 2012 - 12:59 PM
As @zen pointed above... if you use PHP 5.4 you can do that in your code... without changing anything in the Yii core.
Find more about me.... btw. Do you know your WAN IP?
Share this topic:
Page 1 of 1

Help
This topic is locked











