1.2.881. One Object Operator Per Line¶
It is recommended to avoid using more than one operator -> per line, to prevent information overload.
This rule applies to chained calls, and not on distinct expressions, that may end up on the same line.
<?php
// Spread operators on multiple lines
$object->firstMethodCall()
->property
->secondMethodCall();
// This is not readable
$object->firstMethodCall()->property->secondMethodCall();
// This is OK, as objects are different.
$a2->b2($c2->d2, $e2->f2);
?>
1.2.881.1. Specs¶
Short name |
Classes/OneObjectOperatorPerLine |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Available in |