开发者

PHP_CodeSniffer missing Zend standards?

I'm trying to use PHP_CodeSniffer to sniff the problems in a php file according to the zend coding standards. The problem is some of the basic rules are not detected, for example

String Literals
$a = "Example String";
should give 开发者_JAVA技巧a warning because the standard is
$a = 'Example String';

Am I missing something, is this not part of the code standard ?


It is part of the Zend Coding Standard according to the respective pages in the ZF Reference Guide. However, that does not necessarily mean all these rules have been included in phpcs. They are unrelated projects. If you look at the ruleset defined for ZF in phpcs, you will see this notice right on top:

A coding standard based on an early Zend Framework coding standard. Note that this standard is out of date.

Judging by a comment by Thomas Weidner in the Wiki for ZF Coding Standards, there is currently no up-to-date PHPCS ruleset available:

My code sniffer implementation was not finished but it has also not been accepted by Zend. Several rules did not conform, were not checked, or were too strict. I had to delete it from Incubator. You can find the latest version by looking into SVN (

The CS files delivered with PHPCS do not conform any ZF standard.

I was said that Zend will not integrate a own CS testbed as it will use the new Pear2 standard as soon as it's available. This is the reason why I did not do any additional work since last year.

So the actual state is that there is no official CS testbed available.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜