:true: true
:false: false
:ops: !, &&, ||, ==, !=
== Why is this an issue?

include::../description.adoc[]

=== Exceptions

The use of literal booleans in comparisons which use identity operators (`===` and `!==`) are ignored.

== How to fix it

include::../how-to-fix-it.adoc[]

=== Code examples

==== Noncompliant code example

[source,php,diff-id=1,diff-type=noncompliant]
----
if ($booleanVariable == true) { /* ... */ }      
if ($booleanVariable != true) { /* ... */ }   
if ($booleanVariable || false) { /* ... */ }     
doSomething(!false);
----

==== Compliant solution

[source,php,diff-id=1,diff-type=compliant]
----
if ($booleanVariable) { /* ... */ }              
if (!$booleanVariable) { /* ... */ }    
if ($booleanVariable) { /* ... */ }       
doSomething(true);
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

'''
=== on 4 May 2020, 13:31:08 Pierre-Yves Nicolas wrote:
In PHP, this rule should not apply to the operands of ternary operators, see SONARPHP-906.


endif::env-github,rspecator-view[]
