Giter VIP home page Giter VIP logo

symfony-custom-coding-standard's Introduction

symfony-custom-coding-standard's People

Contributors

bertramakers avatar craige avatar djoos avatar droslaw avatar joshuataylor avatar kvdnberg avatar rweich avatar soullivaneuh avatar vincentlanglet avatar wickedone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

symfony-custom-coding-standard's Issues

Scope order should check property and class const

Actuellement,

  • scodeOrder vérifie l'ordre public function, protected function, private function.
  • PropertyDeclarationSniff vérifie que les propriétés sont déclarées avant les fonctions.

Il faudrait un sniff genre ordered_class_elements qui vérifie l'ordre
['constant_public', 'constant_protected', 'constant_private', 'property_public', 'property_protected', 'property_private', 'method_public', 'method_protected', 'method_private']

Bug with array alignment and "newline"

Hi,

Nice piece of code ! Your sniffs files are really usefull.
I found 2 small bugs in the ArrayDeclarationSniff when there is a line return in the declaration. And the phpcs fix command will fail and return an error code = 2 and the file is not fixed.

A)

$array = [
    'lonnnnnnggggg' => 'good',
    'short' 
                 => 'bad',
];

This exemple will not be correctly formated (and the fix command will fail), because the second item will not be considered as a new line because the test in the class (https://github.com/VincentLanglet/symfony-custom-coding-standard/blob/master/SymfonyCustom/Sniffs/Arrays/ArrayDeclarationSniff.php#L607) will check if the arrow is before or after the item based on the length, so it will report 3 spaces found but it should report "newline" found, for the function "fixWhitespaceBefore" to work correctly. I think you should use the 'line' property in the tokens array to confirm if it's a new line or not. Something like :

if ($tokens[$index['index']]['line'] !== $tokens[$index['arrow']]['line']) {
    $found = 'newline';
}

B)

$array = [
    'lonnnnnngggggg' => good,
    $ab .
    'second' => 'bad',
];

In this case the second item arrow should be aligned with the first item arrow. But the phpcs fix command fail and return an error code = 2.
I have no idear how to fix this :)

Keep up the godd work !!!

Let me know if it's not clear.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.