Rector is a FLOSS tool that instantly upgrades and refactors the PHP code of any PHP 5.3+ code. Let's try it.
Source code:
https://github.com/rectorphp/rector
This Task contains some attempts, some configurations to be tested. Feel free to update as you test more.
Configuration to add support up to PHP 8.2
Configuration to remove very old features < PHP 5.5
Execute locally
Create the rector.php file in the root of your repository (copy from the above Pastes).
Then install Rector:
composer require rector/rector --dev
Then run it locally:
vendor/bin/rector process --debug
Online demo:
Documentation: