[PEPr] Comment on RFC::Coding standard enhancements
| From: | Paul Jones | Date: | Fri, 07 Mar 2008 19:15:10 +0000 |
| Subject: | [PEPr] Comment on RFC::Coding standard enhancements | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-49314@lists.php.net to get a copy of this message | ||
Paul Jones (http://pear.php.net/user/pmjones) has commented on the proposal for RFC::Coding standard
enhancements.
Comment:
I have a suggestion on the "how-to" of splitting long if() conditions. I
think we should encourage that the conditions be expressed as variables,
and then use those variables in the if() condition, so as to keep the
condition set all on one line.
Given the original example, that would translate into something like the
following:
$is_foo = ($condition1 || $condition2);
$is_bar = ($condition3 && $condtion4);
if ($is_foo && $is_bar) {
// ....
}
This has the benefit of "naming" the condition sets so they are easier to
distinguish, and splits the different condition sets into readable chunks.
Doing this should greatly reduce the need for splitting if() condition sets
across multiple lines.
Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=538
--
Sent by PEPr, the automatic proposal system at http://pear.php.net