Replace negated boolean literals (!false, !true) with their simplified equivalents (true, false)
-if (!false) {
+if (true) {
return 'always true';
}
-if (!true) {
+if (false) {
return 'never reached';
}
Configure your rector.php:
<?php
use Rector\CodeQuality\Rector\BooleanNot\ReplaceConstantBooleanNotRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
ReplaceConstantBooleanNotRector::class,
]);