Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize CMSObject removals #387

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Reorganize CMSObject removals #387

wants to merge 1 commit into from

Conversation

laoneo
Copy link
Member

@laoneo laoneo commented Feb 13, 2025

User description

Manual entry for pr joomla/joomla-cms#44880.

Followup of #380.


PR Type

Documentation


Description

  • Documented the removal of CMSObject class usage.

  • Explained transition from CMSObject to stdClass.

  • Highlighted affected components and models in Joomla core.

  • Provided examples for adapting to the changes.


Changes walkthrough 📝

Relevant files
Documentation
removed-backward-incompatibility.md
Documented removal of `CMSObject` and transition to `stdClass`

migrations/54-60/removed-backward-incompatibility.md

  • Added detailed documentation on CMSObject removal.
  • Explained the transition to stdClass in core models.
  • Provided examples for replacing CMSObject functions.
  • Highlighted affected components and their adjustments.
  • +49/-44 

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Documentation Clarity

    The documentation should clarify whether existing extensions need to be updated to handle both CMSObject and stdClass during the transition period for backward compatibility

    - Description: The `AdminModel` class does return a `stdClass` object in the `getItem` function instead of a `CMSObject`. This means that all the deprecated functions of `CMSObject` are not available anymore. Mainly the set and get function should be replaced accordingly as documented in the `CMSObject` class or the respective traits. For example you can use 
    ```php

    Copy link
    Contributor

    Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Add type safety warning

    Add a warning note about potential data type issues when accessing properties of
    stdClass objects, since they don't enforce type safety like CMSObject did.
    Developers should implement their own type checking when needed.

    migrations/54-60/removed-backward-incompatibility.md [18-22]

     #### getItem returns a stdClass instead of CMSObject
     
     - PR: https://github.com/joomla/joomla-cms/pull/42961
     - File: libraries/src/MVC/Model/AdminModel.php
    -- Description: The `AdminModel` class does return a `stdClass` object in the `getItem` function instead of a `CMSObject`.
    +- Description: The `AdminModel` class does return a `stdClass` object in the `getItem` function instead of a `CMSObject`. Note that stdClass objects don't enforce property types - developers should implement appropriate type checking when accessing properties if type safety is required.

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 8

    __

    Why: The suggestion addresses an important security and reliability concern by warning developers about the loss of type safety when migrating from CMSObject to stdClass. This is crucial information for maintaining code quality and preventing potential runtime errors.

    Medium

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant