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

PHP snippet to change
Config  rector.php
Rector version: 748330 - released at 2024-10-06 19:25