If yii 1.1.x support PSR-2 ? I mean original framework? If there is some tool to verify if my yii 1.1.x project(or just php project) corresponds to PSR-2 ?I am tring to write in PSR-2, but old habits are difficult to overcome...
Asked
Active
Viewed 326 times
1 Answers
1
Yii does not fully follow PSR-2, there are some differences. You can find the Yii (1) coding style guide here and PSR-2 here.
However you can write your applications code in whatever style you prefer. If you want it to be PSR-2 compatible, the easiest would be to install CodeSniffer and set the standard to PSR-2 and check your code.

chris---
- 1,536
- 1
- 13
- 14
-
Thank you very much! CodeSniffer is great! Also in my yii 1.1.15 I constantly get error at the header of file "Each class must be in a namespace of at least one level (a top-level vendor name)" If there is a way to remove this message as yii 1.1 does not work with namespaces ? Also how can I configure params of verification : say PSR2 standart now is no more 120 symbolls is 1 line. I neglect this as I have big 23 inches monitor : how can I for validation set this parameter to 180? – Aug 13 '14 at 10:17
-
As said Yii is not fully PSR-2, and yes Yii 1.1 does not use namespaces. There is a codesniffer standard for yii which you can find above over the link to it's coding style guide. But note that there is not much of a point to validate the frameworks code itself. Params might be configurable in the ruleset.xml. You can configure the 120 char limit if you open the ruleset.xml of PSR2 standard. But I don't recommend editing this file, it would be better to create your own standard and overwrite this rule there. – chris--- Aug 13 '14 at 10:35