Remove if condition that is always true
final class SomeClass
{
public function go()
{
- if (1 === 1) {
- return 'yes';
- }
+ return 'yes';
return 'no';
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector;
return RectorConfig::configure()
->withRules([
RemoveAlwaysTrueIfConditionRector::class,
]);