Standard In PHP for Return Lines when Chaining Function Calls

coding-style, php

Solution

PSR2 doesn't specify. See https://stackoverflow.com/a/11894206/2016155. Second option is more readable though if you ask me.

Problem

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.

Original source

Related problems