rspec/rules/S4142/php/rule.adoc

43 lines
641 B
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

== Why is this an issue?
include::../description.adoc[]
=== Noncompliant code example
[source,php]
----
if (compare($a+$x, $a+$x) != 0) { // Noncompliant
  //...
}
if (compare(getValue($a), getValue($a)) != 0) { // Noncompliant
  // ...
}
----
=== Compliant solution
[source,php]
----
if (compare($a+$y, $a+$x) != 0) {
  //...
}
$v1 = getValue($a);
$v2 = getValue($a);
if (compare($v1, $v2) != 0) {
  // ...
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
endif::env-github,rspecator-view[]