Component/s: Coding style
The moodle coding standards guideline does not cover method chaining in the line wrapping section.
It would be nice if a standard on method chaining could be added. At the moment, the only way to do method chaining is to keep everything on one line which is not practical in terms of the line size limit.
Method chaining reads really badly if it's all on one line.
Splitting the methods over lines makes it much easier to understand IMO:
However, the current coding standards don't permit white space before object operators.
The above code will result in a code sniff error of:
42 | ERROR | [x] Space found before object operator
There are two ways I can see to resolve this problem:
1) Amend the coding standards to prohibit method chaining. (would make me sad).
2) Amend the coding standards to allow line wrapping for method calls.
I think it would be a shame to prohibit method chaining as it's often a very useful pattern.