Skip to content

Commit

Permalink
SONARPHP-1530 S1125 should raise an issue when a boolean literal is u…
Browse files Browse the repository at this point in the history
…sed in a xor expression (#1334)
  • Loading branch information
jonas-wielage-sonarsource authored Dec 3, 2024
1 parent 914bb6b commit fd46c0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public class BooleanEqualityComparisonCheck extends PHPVisitorCheck {
Kind.ALTERNATIVE_CONDITIONAL_AND,
Kind.EQUAL_TO,
Kind.NOT_EQUAL_TO,
Kind.ALTERNATIVE_NOT_EQUAL_TO
Kind.ALTERNATIVE_NOT_EQUAL_TO,
Kind.ALTERNATIVE_CONDITIONAL_XOR
};

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
|| b
|| true; // Noncompliant
(a || true) ? b : c; // Noncompliant
true xor a; // Noncompliant
$a xor false; // Noncompliant

a === false; // OK - exception
a === true; // OK - exception
Expand Down

0 comments on commit fd46c0a

Please sign in to comment.