On 09/03/2013 10:34 AM, David Deutsch wrote:
- Linebreaks separating variable declaration blocks
Discussion: https://github.com/roundcube/roundcubemail/pull/109#discussion-diff-6064999
I think for this, we will end up reverting some of the changes that I made. But we still have to discuss the details - It's just mainly about the other devs telling me in what instances it would be permissible to separate blocks.
Vertical spacing is also important and I think we should not make the code to be stretched too much. In my opinion we should keep such variable assignment lines together as soon as they are looking/doing similar things or they are a simple assignments like $var = array(); I'd add newline only before comment line or if assignment is very different (in look and logic).
Do not forget about equal sign alignment rule, http://pear.php.net/manual/en/rfc.cs-enhancements.alignassignments.php
- (very minor) One-time use variable declarations
Discussion: https://github.com/roundcube/roundcubemail/pull/114#discussion-diff-6102900
Only happened once so far, I think. Not sure where Thomas stands on it now.
And I suppose this change comes from your hard 80-chars line length limit. So, please, just don't be so strict with the line length limit.
- Linebreaks before ifelse / else statements
Discussion: https://github.com/roundcube/roundcubemail/pull/114#discussion-diff-6102891
I must say this is really the only one that I feel strongly that the codebase should break with tradition because I think that doing it this way makes it very hard to follow the code. There is also no standard I have seen so far that encourages linebreaks there (I know, I know, appeal to popularity). In most cases, I think what everybody would prefer is proper separation into individual functions or rewriting the structure in some other way, so maybe Alec and Thomas will accept that removing the linebreaks is a temporary thing until we arrive at something better.
I just found it to be much more readable if there's a new line. Also, I'd like to put comments before else, not inside the block. So, if we need temporary solution, please add linebreaks.
Standards with newline before else: Drupal, PHP Developer, FuelPHP. So, really, it's not our invention.