Reputation: 5432
Is there any strict requirement if chaining should be aligned starting with the class vs. methods only?
Chaining with only methods being aligned:
$this->fooService
->doBar()
->doBaz();
Above example shows the alignment just within methods.
Chaining with everything being aligned:
$this
->fooService
->doBar()
->doBaz();
This question is not opinion based as I'm asking about coding standard defined by the PHP community.
Upvotes: 6
Views: 1270
Reputation: 646
The PSR and PSR 2 do not specify anything regarding method chaining from what I have read. PSR concludes that "interline alignment" is intentionally left out
Upvotes: 4