Simplify negated conditions with de Morgan theorem
$a = 5;
$b = 10;
-$result = !($a > 20 || $b <= 50);
+$result = $a <= 20 && $b > 50;
Configure your rector.php
:
<?php
use Rector\CodeQuality\Rector\BooleanNot\SimplifyDeMorganBinaryRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
SimplifyDeMorganBinaryRector::class,
]);