djoos / Symfony-coding-standard

Development repository for the Symfony coding standard
MIT License
402 stars 102 forks source link

Current sniffs #64

Closed wickedOne closed 7 years ago

wickedOne commented 7 years ago

As suggested in #32, i think it would be good to have some kind of list indicating which standards are already enforced by this repo and which still need to be done.

this not only makes it easier for contributors to find a sniff they can work on, but also to see which new standards have been added to the Symfony standards page as that list appears to be changing quite a bit.

opening a seperate issue for each missing sniff might clutter the issues list so i'd like to propose grouping them like they are grouped on Symfony's standards page. which could look like something like this:

Structure

and perhaps to clarify include an example for each rule which should trigger an error, e.g.

<?php
    // Add a single space after each comma delimiter;
    function foo($a,$b){}

    // Add a single space around binary operators
    if ($a==$b){}

    // Place unary operators adjacent to the affected variable
    $a = $b++;

    // Always use identical comparison
    if ($a == $b) {}

    // Use Yoda conditions
    if ($a == 1) {}

    // Add a comma after each array
    $a = [
        'foo',
        'bar'
    ];

    // Add a blank line before return statements
    function foo()
    {
        $a = $b;
        return $b;
    }

    // ... etc

any thoughts on this?

djoos commented 7 years ago

This is a brilliant suggestion - perfectly in line with the frustration of #32!

wickedOne commented 7 years ago

excellent! i'll open a couple of issues this weekend listing the snifss already implemented and those which still need to be done and include a class from hell which should trigger all of the mentioned standards in order for the issue to be resolved