Re: Re: [PEPr] Comment on RFC::Coding standard enhancements
| From: | Helgi Þormar Þorbjörnsson | Date: | Sat, 08 Mar 2008 13:44:06 +0000 |
| Subject: | Re: Re: [PEPr] Comment on RFC::Coding standard enhancements | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-49332@lists.php.net to get a copy of this message | ||
On Fri, Mar 7, 2008 at 5:17 PM, Philippe Jausions <
Philippe.Jausions@11abacus.com> wrote:
> Philippe Jausions wrote:
> > Philippe Jausions (http://pear.php.net/user/jausions) has commented on
> the proposal for RFC::Coding standard enhancements.
> >
> > Comment:
> >
> > - "Split long if statements onto several lines". For better readability
> > expressions in parentheses should be indented by 1 for each grouping.
> i.e.
> > (Note: I'm not sure how that'll look on the comment once posted though)
> >
> > if (($condition1
> > || $condition2) <-- indent 6 spaces here
> > && ($condition3 <-- indent 5 spaces here
> > && $condition4) <-- indent 9 spaces here
> > ) { <-- indent 4 spaces here (?)
> > //code here
> > }
>
> My count was wrong, but you get the idea
>
> if (($condition1
> || $condition2) <-- indent 5
> && ($condition3 <-- indent 4
> || $condition4) <-- indent 8
> ) { <-- indent 3 to align with "(" or 0 (?)
> // code here <-- indent 4
> }
>
I tend to align with if because most editors place the new line there which
means I don't have to hit space 3x (tab produces 4 spaces) so I think we
should go for the least key hitting solution plus it makes it obvious we're
closing the if above.
- Helgi