On 09/10/2013 06:24 PM, Thomas Bruederli wrote:
I'm willing to bear some pain when I see a benefit. But I more and more have the feeling that we got ourselves into a bikeshed discussion. And I'd therefore appreciate other opinions on this. If I'm really the only dickhead who hates the PSR-2 if/else syntax, I'll step back.
Thomas, we both agree on this one. I don't see a reason to discuss this more.
For the "no returns in the middle of a function" requirement, I would like to have one clarification. As an example, this function here ends with a rather long if and a small else:
https://github.com/daviddeutsch/roundcubemail/blob/20de28b9e94a5f001161ca49f...
I would usually invert the if and in that "return $fields['user'];". Would that be permissible?
I tend to say no on this. But again, I'd like to hear others speaking up for or against single exit points. For me these are like GOTO commands. They suddenly make the program jump out of the current block which - especially if it's a function - has a clear beginning and an end.
I have no strong opinion about this. I such case number of lines inside the if statement body might be relevant. I can also agree with you, but for now I just propose to not do such modification in current cleanup trial.