41 lines
854 B
Plaintext
41 lines
854 B
Plaintext
== Why is this an issue?
|
|
|
|
Calling the ``++!++`` or ``++~++`` prefix operator twice does nothing: the second invocation undoes the first. Such mistakes are typically caused by accidentally double-tapping the key in question without noticing. Either this is a bug, if the operator was actually meant to be called once, or misleading if done on purpose.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,php]
|
|
----
|
|
$a = 0;
|
|
$b = false;
|
|
|
|
$c = !!$a; // Noncompliant
|
|
$d = ~~$b; // Noncompliant
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,php]
|
|
----
|
|
$a = 0;
|
|
$b = false;
|
|
|
|
$c = !$a; // Compliant
|
|
$d = ~$b; // Compliant
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|