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:
-
We stick to Symfony2 coding standard and PSR-0, PSR-1, PSR-2 and PSR-4 rules.
-
Don't use Hungarian Notation - in time of type hinting and PHP7 it has no point.
-
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.
-
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.