Hey guys!
I'd looked through all existing coding-style standards (PSR-1, PSR-2, PSR-12) and actually failed to find any suggestions about formatting of long conditionals. We have standards for long argument lists, long "implements" lists, long "use" lists, but what about long conditions?
For example:
if (($someLongVariable && $anotherLongVariable) || $moreLongVariablesHere || $this->andEvenSomeLongMethodCall()) {
//body here
}
Can be formatted like this:
if (
($someLongVariable && $anotherLongVariable)
||
$moreLongVariablesHere
||
$this->andEvenSomeLongMethodCall()
) {
//body here
}
or like this:
if (
($someLongVariable && $anotherLongVariable) ||
$moreLongVariablesHere ||
$this->andEvenSomeLongMethodCall()
) {
//body here
}
or in some other way.
Do we have a standard for this somewhere?
Thanks.