pretty-php
pretty-php copied to clipboard
Document "hanging" vs "overhanging" indentation
A rough starting point:
.OH.is applied if:
- the open bracket of the block is not followed by a newline, AND
- either:
the block contains
,- or;- delimited items, ORthe block forms part of a structure that continues, e.g.
if ($block) { // continuation }1. Standard indentation is sufficient [ ___, ___, ___, ___ ] 2. One level of hanging indentation is required [ ___, ___ .hh.___, ___, ___, ___ ] 3. One level of hanging indentation is sufficient [___, ___, .hh.___, ___] 4. Two levels of hanging indentation are required [___, ___ .hh..OH.___, ___, .hh.___, ___] 5a. Two levels of hanging indentation are required per level of nesting [___, [___, .hh..OH..hh.___], .hh.___,[___, ___ .hh..OH..hh..OH.___, .hh..OH..hh.___]] 5b. [[[___ .hh..OH..hh..OH..hh..OH.___, .hh..OH..hh..OH..hh.___], .hh..OH..hh.___], .hh.___]