Change switch() to match()
-switch ($input) {
- case Lexer::T_SELECT:
- $statement = 'select';
- break;
- case Lexer::T_UPDATE:
- $statement = 'update';
- break;
- default:
- $statement = 'error';
-}
+$statement = match ($input) {
+ Lexer::T_SELECT => 'select',
+ Lexer::T_UPDATE => 'update',
+ default => 'error',
+};
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
return RectorConfig::configure()
->withRules([
ChangeSwitchToMatchRector::class,
]);