I haven't been able to find an answer for this in any of my Google searches but is there a standard/best practice for return lines before or after the arrow operator when I chain function calls across lines?
The two options I've come up with are return after the arrow operator:
$myclass->
foo->
bar->
baz();
And before the arrow operator:
$myclass
->foo
->bar
->baz();
We're trying to stick to PSR-2 coding standards if at all possible.
PSR2 doesn't specify. See https://stackoverflow.com/a/11894206/2016155. Second option is more readable though if you ask me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With