2 following switch keys with identical will be reduced to one result
class SomeClass
{
public function run()
{
switch ($name) {
case 'clearHeader':
return $this->modifyHeader($node, 'remove');
case 'clearAllHeaders':
- return $this->modifyHeader($node, 'replace');
case 'clearRawHeaders':
return $this->modifyHeader($node, 'replace');
case '...':
return 5;
}
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector;
return RectorConfig::configure()
->withRules([
RemoveDuplicatedCaseInSwitchRector::class,
]);