Exakat Blog: EPIC : Exakat PHP Index of Coding (May 2018)
The Exakat blog has an interesting post to their site sharing some statistics from the applications they've scanned related to commonly used coding styles. In this PHP Index of Coding (for 2018) they share a listing of practices in the order of popularity according to the results of over 1700 projects.
Not using @ is the poster child of good practices. It’s also looked upon, as an impossible goal. Did you know that the @ operator is only merely used by 50% of PHP applications ? Same for parenthesis with include (and co) : don’t use them, like 50% of the developpers. This is how the Exakat PHP Index of coding was born.Every month, Exakat runs thousands of analysis on half a billion lines of PHP code. This is primarily for testing purpose, a kind of torture test that checks the engine runs on any kind of code. And it is very useful to ensure all situations are correctly handled.
We also extracted the following stats out of 1700+ projects, analysis by analysis. This way, any issue may be ranked from ‘wide spread’ to ‘very unusual’. In fact, ‘wide spread’ may also be understood as : ‘almost a feature’.
The results are ranked by frequency of appearance with the top five being:
- Uses Default Values
- Used Once Variables (In Scope)
- Unused Methods
- Method Could Be Private Method
- Should Use Local Class
For each item in the list there's a link to more information about the check and how much it has changed since the last time the index was generated.