What should the standard be for tabbing in parameters on function calls that span multiple lines?
i.e. when stringing the function name and all the parameters in one line makes the line "too long".
e.g.
Try to "line up" the additional parameters under the first parameter.
a) By putting enough TAB and space characters assuming that each TAB is being displayed at 4-space intervals in some editor:
TAB do_stuff($parameter1,
TAB TAB TAB space "Second parameter is some literal text",
TAB TAB TAB space $parameter3);
b) By putting enough TAB and space characters assuming that each TAB is being displayed at 8-space intervals in some editor:
TAB do_stuff($parameter1,
TAB TAB space "Second parameter is some literal text",
TAB TAB space $parameter3);
c) By putting TAB characters to the function name then space characters to fill out under the function name:
This avoids any assumption about the editor TAB display mode.
TAB do_stuff($parameter1,
TAB 9space "Second parameter is some literal text",
TAB 9space $parameter3);
Forget about lining up under the parameter on the first line, always indent subsequent lines by 1 TAB:
TAB do_stuff($parameter1,
TAB TAB "Second parameter is some literal text",
TAB TAB $parameter3);
Put the function name on a line by itself and all the parameters on later lines, always indented by 1 TAB:
TAB do_stuff(
TAB TAB $parameter1,
TAB TAB "Second parameter is some literal text",
TAB TAB $parameter3);
and if one of the parameters has some really long literal stuff, like long text, then extra lines that continue the same parameter are indented an extra TAB:
TAB do_stuff(
TAB TAB $parameter1,
TAB TAB gettext("Second parameter is some literal text that goes on and on and has line breaks.") . '
' .
TAB TAB TAB gettext("There is a lot to explain to the user.") . " " .
TAB TAB TAB gettext("So we need to concatenate a lot of text together into a single parameter."),
TAB TAB $parameter3);
TAB do_stuff(
TAB TAB $parameter1,
TAB TAB gettext("Second parameter is some literal text that goes on and on and has line breaks.") . '
' .
TAB TAB TAB gettext(
TAB TAB TAB TAB "There is a lot to explain to the user. " .
TAB TAB TAB TAB TAB "So we need to concatenate a lot of text together into a single parameter. " .
TAB TAB TAB TAB TAB "And sometimes the parameters passed are themselves a function that spans multiple lines."),
TAB TAB $parameter3);
The code currently uses various ways to do it, and it would be nice if there was a standard so that there does not need to a banter about it with each pull request!
Personally I like (3)+(4).