Changes multi catch of same exception to single one | separated.
try {
// Some code...
-} catch (ExceptionType1 $exception) {
- $sameCode;
-} catch (ExceptionType2 $exception) {
+} catch (ExceptionType1 | ExceptionType2 $exception) {
$sameCode;
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php71\Rector\TryCatch\MultiExceptionCatchRector;
return RectorConfig::configure()
->withRules([
MultiExceptionCatchRector::class,
]);