2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2020-06-30 12:48:07 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
2023-06-27 15:03:47 +02:00
|
|
|
== How to fix it
|
2020-06-30 12:48:07 +02:00
|
|
|
|
2023-06-27 15:03:47 +02:00
|
|
|
=== Code examples
|
|
|
|
|
|
|
|
==== Noncompliant code example
|
|
|
|
|
|
|
|
[source,php,diff-id=1,diff-type=noncompliant]
|
2020-06-30 12:48:07 +02:00
|
|
|
----
|
|
|
|
for ($i = 0; $i < $length; $i--) { // Noncompliant
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2023-06-27 15:03:47 +02:00
|
|
|
==== Compliant solution
|
2020-06-30 12:48:07 +02:00
|
|
|
|
2023-06-27 15:03:47 +02:00
|
|
|
[source,php,diff-id=1,diff-type=compliant]
|
2020-06-30 12:48:07 +02:00
|
|
|
----
|
|
|
|
for ($i = 0; $i < $length; $i++) {
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2023-06-27 15:03:47 +02:00
|
|
|
include::../rspecator.adoc[]
|