Ensuring compatibility is crucial for delivering a top-notch product, and with Rector, this can be achieved by configuring Rector Rulesets.
To adhere to best practices, Sugar advises developers to write their customizations using the latest version of Sugar Supported PHP and making sure that backward compatibility is maintained using Rector.
It is important to note that some Sugar customers may still be operating on older versions of Sugar on their on-premise instances, which should be taken into consideration when determining the appropriate PHP version to use for customizations.
Downgrade to PHP 7.4
Modify rector.php to make sure that the code is still compatible with PHP 7.4, and replace the “UP_TO_PHP_82
“ and “PHP_82
“ rule sets with 7.4 ones:
$rectorConfig->sets([ \Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_74, \Rector\Set\ValueObject\DowngradeSetList::PHP_74, ]);
At this point, you can now follow the Execute Rector making sure you keep git updated so you don't loose track of what has changed between PHP versions.
Incompatibilities Only
We have provided a configset to enable you to maintain your code compatible from PHP7.4 to PHP8.2 where Rector will only modify your code for breaking changes between those versions.
You do not need to downgrade and upgrade but just keep your code safely compatible by using either this or this configset.