yiisoft / yii2-coding-standards

Yii 2 coding standards
182 stars 49 forks source link

disallow old array() syntax #13

Closed nkovacs closed 10 years ago

nkovacs commented 10 years ago

Since Yii2 uses the short array syntax, I wrote this sniff to catch accidental use of array().

I checked the framework source, and it found a couple files, mostly translation files and requirements.php (I guess that one has to stay so that it can run on older php, so it can be added to exclusions).

klimov-paul commented 10 years ago

We may have long array syntax at some places. For example: YiiRequirementChecker needs it. Whould this PR create a problem for such code?

nkovacs commented 10 years ago

You could add codingStandardsIgnore tags to code that needs it. The rest should be fixed.

nkovacs commented 10 years ago

I've added an exclude pattern to ignore the entire requirements directory, and removed the two separate ones. Here are all the errors and warnings in the framework directory: https://gist.github.com/nkovacs/e70f105e68e79bf0260d

nkovacs commented 10 years ago

Well?

samdark commented 10 years ago

Merged. Thanks!