Coding standard enhancements
Table of Contents
- Split function definitions onto several lines
- Split function call on several lines
- Split long assigments onto several lines
- Split long if statements onto several lines
- Ternary operators
- Alignment of function parameters
- Alignment of assignments
- Array formatting
The PEAR Group has voted and accepted this document. There will be no voting among developers.
This proposal has been in PEPr as » proposal #538.
This RFC defines changes and enhancements to the current Coding Standards (CS) in PEAR. They are neccessary because the standards are not clear in some cases. With applications like » PHP_CodeSniffer being used, is is important that those issues are worked out and tools can deliver reliable warnings and CS errors.
Most of the issues we currently have deal with long lines and how they should be split. General rule of thumb is that when splitting a line, the originating lines are indented by 4 spaces. Futher, the format shall allow it to easily comment out those lines - be it for debugging or development reasons. This implies that closing braces are to be put on a line on its own, and commas at the end of a line.
While it might seem archaic to some, the 75-80 line rule is still important. Please see » http://paul-m-jones.com/?p=276 for an in-depth discussion on the topic.