Remove if/else if they have same content
class SomeClass
{
public function run()
{
- if (true) {
- return 1;
- } else {
- return 1;
- }
+ return 1;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\If_\SimplifyIfElseWithSameContentRector;
return RectorConfig::configure()
->withRules([
SimplifyIfElseWithSameContentRector::class,
]);