Closed x00xer closed 9 years ago
Please be more specific. From your description I can determine 2 issues (correct me if I'm wrong):
Zend
standard through PHP_CodeSniffer
PHP_CodeSniffer
What you think is our next step?
The Zend coding standard inside PHP_CodeSniffer is not the Zend Framework coding standard. It is just a collection of sniffs contributed to me by people at Zend, but it is not the current ZF coding standard, and probably never will be.
To check your code against the Zend Framework coding standard, you'll need to speak to the ZF developers to see if they have written a standard for PHPCS. I'm not aware of a current one, but I've never used ZF so I'm not up to date with their available tools.
Ok, I see. Then could you please clarify, from all sniffer what is included into PHP_CodeSniffer, which one can be matched with available one ? PSR, PEAR etc .. ? For example PSR-1 and PSR-2 from PHPCS are different standarts, but from developer point psr2 including psr1. What the best practise to work with phpcs ? create own standard file ?
The PSR2 standard in PHPCS already includes all of the PSR1 standard as well: https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/PSR2/ruleset.xml#L10
PEAR and Squiz are also complete standards, but less commonly used.
If the built-in ones don't meet your requirements, you can create a custom standard using a ruleset.xml file. This allows you to bring various checks together in a custom way.
The file format is documented here: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
If you are not sure what standard to use, I suggest starting with PSR2.
thanks for explanation
thanks for explanation
No problem. If you need help creating a ruleset, you can contact me directly as well: gsherwood at squiz dot net
Hello, I'm trying to attach phpcs to my project and I'm not successful in that ;(
this is my conf file
this is coding style which I'm checking http://framework.zend.com/manual/1.12/en/coding-standard.coding-style.html
this is my testing file
from the link above (coding standards) there are few sections which is does not work
and this is result when I'm running phpcs
I'm just not sure is it ok ? Should I do something manually ?