A better solution to coding standards
PSR-2 has been around for a while now, and has (completely rightly) drawn a lot of criticism. There have been several attempts to fix the inconsistencies and problems with the standard such as PSR-2-R which is a far more sane standard...
...in my opinion. The problem, of course, is that nobody will ever agree on tabs vs, spaces or whether braces should go on the same line or next line (although it baffles me that PSR-2 wants braces sometimes on newlines and sometimes on the same line).
So my question to my readers are: Why should we enforce our preferences on others. When you sit in an office do you force everyone in the office to have their chairs at the height you feel most comfortable with?
Perhaps that's a bad analogy as it's to do with code. Ok, do you force everyone in the project to use the same IDE? Or the same code font or syntax highlighting colours?
If not, why not? Forcing font styles is no different than forcing coding styles on people. The problem, of course, is that code style has an effect on everyone because we all see each other's code.
Wouldn't it be better if we treated code style preferences like font and syntax colouring preferences and allowed each team member to view the code and work with it however they like? Tabs? Spaces? Brace positions?
It's not difficult to set up your IDE to format code in a certain way whenever it loads a file. The problem with this, of course, is that when you commit changes to the repository, it messes up commits because hundreds of changes have been made to the file.
But, this flexibility is what we should really strive for. Let each person specify their preferences with how they see the code and edit it in the way that's best for them.
It's not a difficult problem to solve: Create a git hook that formats the code for checkout and commit. A pre-commit hook that runs the code through a code formatter so the code is consistent in the repository and a post-checkout hook that each team member can set up to checkout the code in any style they like.
If we did this, we would alleviate thousands of endless and pointless arguments about where to put braces.
Just some food for thought...