Introduce Code convention

I know that this topic has been discussed in this forum and led to religious wars :-D. I would like to sum my minds and add some facts that really matter for our work and why I would strongly suggest code conventions because it makes a big difference for the workload in the end. We make extensive use of PHP checkstyle over here. The reason is, that every team member shall be able to change every line of code, we do not have code ownership, the team owns the code.

Unfortunately, with diverging style habitats, not only formatting, but naming and so on every change by a different developer usually not only changes the lines where the new functionality is implemented but also every other line because of reformatting. This is a big problem, since we are doing a lot of branches and merges using git and it es quite simple to do the merge, when the differences shown are only, where there is a difference in functionality. It becomes pure horror, when the whole file is shown as different caused only by different formatting.

This leads us to the next point. I really like the idea of sharing extensions for Yii. But the big problem for us is, that we usually have to do minor to major adaptions to the extensions and we therefore put it under version control as well. If the coding style used in an extensions is quite different from ours, it makes Checkstyle go crazy and makes the CI server sending a hellish red to the xtreme feedback device, melting our smartphones in agony. So we usually do not use most of the extensions, because adapting it to our style needs often takes longer than desirable. So please consider developing a code convention and provide a checkstyle configuration file for it.

Kind regards,


I agree with you, we would like if there would be some style/code conventions.

But for your issue, can you exclude some extension folders from checkstyle? On Zurmo, we also have our own style checker, and we excluded extension folders from style checking. It doesn’t worth modifying them, and what if authors publish improved version of their extension, you will have nightmare to update them.

I’m working on the style itself. Probably will add config for phpcs when style guide itself will be finished.