Clear PHP reaches 100 rules
Last week, we published the 100th rule in clear PHP. They represent recommendations to write clear PHP code. Such recommendations has various effect :
- avoid common pitfalls (No Unchecked Resources)
- prepare code for recent versions (Use Smart Autoload)
- complete some check that the engine doesn’t do ( No Switch With Multiple Default)
- apply common sense (No Useless Math)
With 100, I fear that I’m still half way. My guess is 200 rules will eventually be reached. Currently, I’d like to slow the pace creating new rules, and take some time to strengthen and feed the current one with more examples or explanations.
Clear PHP : reference for clear coding in PHP
The target for this reference is to be used as list of ingredient : any project should be able to build his own coding reference by choosing a set of those recommendations, and enforcing them.
The recommendations find their place between coding conventions and code conception. Some of the recommendations may fall in different categories : bracketless blocks may be a coding convention (something that is commonly accepted) or seen as a bug generating feature, and set as a clear PHP recommendations. I believe it is the second, but your milage may vary.
Take it, use it, contribute
If we missed something, feel free to contribute by forking the repository or simply mailing me directly. That may be extra code examples, edge cases that are exceptions or special situations that tend to be missed, translation into other langages or a full new clear PHP rule.