[TYPO3-50-general] Willing to help Task #1 Create sniffs for PHP Code Sniffer

Robert Lemke robert at typo3.org
Tue Dec 11 12:28:31 CET 2007

Hi Tim,

Am 10.12.2007 um 22:18 schrieb Tim Eilers:

>> You intuitively did already what is called Test Driven Development:  
>> You
>> started extracting the rules and then move on to coding.
> Wow i am good! Ehem, just a little joke ;)


Just to add that: It is important to first write the tests and then  
the sniffs. You go through this cycle:

  - Write a so called "fixture" - a code snippet which contains the  
error in
    the coding standard you want to expose

  - Write a unit test which takes this code snippet and runs PHP Code  
    to see if he recognizes the error or not

  - The test should fail of course because you did not yet implement  
the sniff
    which can recognize the error.

  - Now (not earlier) you start to implement the sniff.

  - Run the unit test again - now it should run through because your  
    detected the error in the fixture.

  - start from the beginning

> Ok, did it. Priorities are just assumed by me, if you see it a other
> way, please correct. I am sure you are more experienced and now what  
> is
> important by already having coded many parts.
> Later i will try to assume the difficulty of implementing a sniff for
> the rule, which will surely not be the same than the priority in some
> cases ;)
> I noticed many Sniffs in the other CodingStandards (PEAR, Zend, ...),
> but that are many ones, and i don't know which are important for
> TYPO3... Perhaps later i get deeper into it and can suggest you new
> rules, which should find their way into the coding guidelines.
> For my first experiment i took a PEAR sniff and rewrote it to fit to  
> the
> according TYPO3 rule.


> Ok, as i wrote above, i already put an initial version into the  
> wiki...

I have added a few comments and also removed a few rules which are not
necessary to check for.


More information about the TYPO3-project-5_0-general mailing list