Run Rector on your code to see what it can do for you:

 <?php
 
 $x = 0;
-2 * $x += 42 and true;   # → true, and $x is 42
+2 * $x += 42 && true;   # → true, and $x is 42
 
 $x = 0;
-2 * ($x += 42) and true; # → true, and $x is 42
+2 * $x += 42 && true; # → true, and $x is 42
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: f84027 - released at 2026-07-15 19:02