I have to say it from the start, the only thing that comes close to safely upgrading a codebase is having a solid set of automated tests. Nothing gives you more comfort than a bunch of green checkmarks dancing on the screen. With that said, we're going to upgrade a Laravel project running on the soon-to-be-dead https://www.php.net/supported-versions.php. Currently, the last stable PHP version is 8.1 and we're going to upgrade to it using a tool called https://getrector.org/.
You can modify it to tell Rector to upgrade all the codebase up to PHP 8.1, with this configuration: return static function (RectorConfig $rectorConfig): void { $rectorConfig->paths([ __DIR__.