Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.39 KB

File metadata and controls

30 lines (21 loc) · 1.39 KB

code style

We all need an easy to read source code, because it is itself the best type of documentation. That's why we came up with following rules:

  1. We stick to Symfony2 coding standard and PSR-0, PSR-1, PSR-2 and PSR-4 rules.

  2. Don't use Hungarian Notation - in time of type hinting and PHP7 it has no point.

  3. Don't use words like *Provider or *Manager etc. in class names because it's biasing the real point of a class, can break the SRP rule and can encourage developers to put more and more code into this class which will became a "trashcan" for different code. Use explicit name instead, that will clearly describe responsibility of the object.

  4. Always name your objects, methods and variables after the things that they really are. This is bad:

    foreach($tmp as $i => $j);

    And this is good:

    foreach($usersWithBasket as $userEmail => $productInTheBasket);

    Variables like $a, $i, $j, $k, $tmp, $temp are a nightmare for a reader! Longer and descriptive variable name is better than a short one.