47 lines
1.1 KiB
Plaintext
47 lines
1.1 KiB
Plaintext
Shared coding conventions allow teams to collaborate effectively.
|
|
|
|
|
|
This rule checks that when
|
|
|
|
* an assignment is too long to fit on one line, the line break is inserted before the ``++=++`` rather than after, and the second line of the statement is indented from the first.
|
|
* an object operator is the first thing on the line, it is indented from the previous line.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,php]
|
|
----
|
|
$variable_with_a_very_very_long_name = classInstance.method1().method2().
|
|
method3(); // Noncompliant, linebreak after '='
|
|
|
|
$variable_with_a_very_very_long_name
|
|
= classInstance.method1().method2().method3(); // Noncompliant, 2nd line not indented
|
|
|
|
$a = classInstance.method1().method2().method3()
|
|
->property1; // Noncompliant,
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
[source,php]
|
|
----
|
|
$variable_with_a_very_very_long_name
|
|
= classInstance.method1().method2().method3();
|
|
|
|
$a = classInstance.method1().method2().method3()
|
|
->property1;
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
include::parameters.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|