PHP_CodeSniffer missing Zend standards?

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

String Literals $a = "Example String"; should give a warning because the standard is $a = 'Example String'; 

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

+4
source share
1 answer

This is part of the Zend coding standard according to the corresponding pages of the ZF Reference Manual . However, this does not necessarily mean that all of these rules have been included in phpcs . These are unrelated projects. If you look at the ruleset defined for ZF in phpcs , you will see this notification right at the top:

A coding standard based on the early Zend Framework coding standard. Please note that this standard is deprecated.

Judging by Thomas Weidner 's comment on the Wiki for coding ZF Standards , there are currently no PHPCS rule sets available:

My implementation of the code sniffer was not completed, but it was also not accepted by Zend. Several rules did not comply, were not checked, or were too strict. I had to remove it from the incubator. You can find the latest version by looking at SVN (

CS files shipped with PHPCS are not ZF compliant.

I was told that Zend will not integrate its own CS test bench, as it will use the new Pear2 standard as soon as it appears. It is for this reason that I have not done extra work since last year.

Thus, the actual state is the absence of an official CS test bench.

+5
source

All Articles