Run Rector on your code to see what it can do for you:

 
 try {
     throw new TypeError();
-} catch(RuntimeException $e) {
+} catch(RuntimeException|Error $e) {
    throw new Exception(); 
 } catch(TypeError $e) {
     echo 123;
     
-    throw new Exception();
-} catch(Error $e) {
     throw new Exception();
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: c75ecb - released at 2025-06-18 23:17