Whenever I bump PHP to the latest version, something on my site breaks, usually some dusty old plugin. I want the speed boost but NOT the stress. How do you guys handle PHP updates without your site falling apart?
/u/bublay Tip: You might want to start with lower upgrades (UP_TO_PHP_74 ?) first. Rector will also tell you which rules it applied. So you can also just apply one such rule at a time.
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
return static function (RectorConfig $rectorConfig): void {
// $rectorConfig->rule(\Rector\..::class); // Just one rule.
// There is also ->rules([]), just like ->sets([]) here below:
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_85, // Choose your own adventure
]);
};
Then run this to update .php files in the director src/
./vendor/bin/rector process src --dry-run
./vendor/bin/rector process src
PHP 8.5 is fairly new, so the rules might be incomplete at the moment. YMMV. On my install it's basically empty, just triggers a cascade to also apply older PHP version upgrade rules.
View all comments
13
u/jesusdiez Nov 19 '25
https://getrector.com/