SugarClub
SugarClub
  • User
  • Site
  • Search
  • User
  • Groups & Discussions
    Groups & Discussions
    • Product Forums
      Product-focused Q&A, discussions, best practices, fixes, and help
      Product Forums
      • Sugar Market
      • Sugar Sell & Enterprise
      • Sugar Serve
      • sales-i
    • User Groups
      Professional, Industry, Language
    • Get Involved
      Learn how to become a Raving Fan
    • Social Club
      Live, interactive, virtual meetups with other Sugar customers and Sugar’s Subject Matter experts!
    • Leadership Lounge
      Network with fellow organizational leaders, ask questions, and share insights
    • Developers
      Visit DevClub, the SugarClub group for Sugar Developers
      Developers
      • DevClub
      • Mobile Developers
      • Developer Builds
        Supplemental access level required. Inquiries: developers@sugarcrm.com
    • Additional Groups (Access Required)
      Groups that require special access will be displayed here. Contact sugarclub@sugarcrm.com for assistance. Click here to see all groups
      Additional Groups (Access Required)
      • SugarCloud Platform
  • Product Information
    Product Information
    • Release Central
      Find release-specific content to prepare for your next Sugar update
    • Documentation & Resources
      Looking to expand your Sugar knowledge? Explore our in-depth documentation and other helpful resources!
    • Product Update Blogs
      Updates about each Sugar product
    • Customer Stories »
      Case Studies by SugarCRM
  • Training & Certification
    Training & Certification
    • Training & Certification Home
      Live & On-Demand classes, Quick Videos, Sugar Certifications, and more!
    • Quick Videos
      Short videos about using Sugar
    • My SugarU Dashboard »
    • SugarU News & Updates
  • Adoption
    Adoption
    • Grow Adoption Framework
      Get started on your adoption journey and review the adoption resources from SugarCRM
  • Calendar
  • News
    News
    • Sugar News
    • SugarCRM.com News »
    • Dev Blog
    • SugarCRM Marketplace Blog
  • Help
    Help
    • Welcome to Sugar!
      New to Sugar? Get started here!
    • SugarClub Help & Instructions
      Learn more about SugarClub and find answers to questions about this site
    • New to SugarClub?
      Start your community journey here
    • Technical Support
      Sugar's support resources
      Technical Support
      • Case Portal »
        Access the SugarCRM Case Portal
      • Working with Sugar Support »
        Find out more about engaging with the SugarCRM Support team
      • SugarCloud Information
        Find information about SugarCloud service updates and site status. Contact sugarclub@sugarcrm.com to request access
  • More from Sugar
    More from Sugar
    • DevClub
    • PartnerClub
    • Support
    • SugarOutfitters Marketplace
    • sugarcrm.com
  • DevClub
  • PartnerClub
  • Support
  • Marketplace
  • sugarcrm.com
DevClub
DevClub
Dev Tutorials Keeping Compatibility
Click here to join this group and curate your SugarClub experience.
  • +On-Boarding Framework
  • +Customization Guides
  • +Modern UI Technical Guide
  • -Automated PHP Compatibility Tool
    • Rector Basic Setup
    • Prepare Rector for MLP/Addon
    • Prepare Rector for Customizations
    • Executing Rector
    • Keeping Compatibility
    • Troubleshooting Rector
    • PHP 7.4 Warnings to PHP8.2 Errors
  • Did you know? Copying related records is a breeze!
  • How to write code for SugarCloud webinar Q&A
  • HOW TO: enforce ACL on Tags
  • Programatically manage Dropdown List
  • Remove custom fields created via package installation
  • Sugar Developer Tools
  • Tutorial:  How to register custom platforms in Sugar instances via Platform extension
  • Adding a google reCAPTCHA in a Web-to-Lead form
  • Sugar Developer Blog Style Guide

Keeping Compatibility

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.

Recommended Approaches

You have two distinct approaches to ensure the compatibility of your customizations. The recommended method involves coding your customizations in PHP 8.3 and utilizing rector to ensure backward compatibility. Alternatively, you can adopt the second approach by adding configsets to your configuration to address only the breaking changes between versions.

Code in PHP8.3 and make it backward compatible by downgrading 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_83“ and “PHP_83“ rule sets with 7.4 ones:

Fullscreen
1
2
3
4
$rectorConfig->sets([
\Rector\Set\ValueObject\DowngradeLevelSetList::DOWN_TO_PHP_74,
\Rector\Set\ValueObject\DowngradeSetList::PHP_74,
]);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    $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 lose track of what has changed between PHP versions.

Make upward compatible by refactoring Incompatibilities Only

We have provided a configset to enable you to maintain your code compatible from PHP7.4 to PHP8.3 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.

  • 0 comments
  • 0 members are here
  • Sign in to reply
Related
Recommended