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

Fix the data dynamic property in WP_Term #4307

Conversation

anton-vlasenko
Copy link

@anton-vlasenko anton-vlasenko commented Apr 5, 2023

This PR aims to solve the issue with the WP_Term::$data dynamic property.
The WP_Term class employs the __get magic method to compute the object data.
However, since PHP 8.2 does not support dynamic properties, it is better to eliminate this approach.

Trac ticket: https://core.trac.wordpress.org/ticket/58087


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@anton-vlasenko anton-vlasenko changed the title Fix the 'data' dynamic property in WP_Term Apr 5, 2023
@anton-vlasenko anton-vlasenko changed the title Fix the data dynamic property in WP_Term Apr 5, 2023
@anton-vlasenko anton-vlasenko marked this pull request as ready for review April 5, 2023 19:15
@anton-vlasenko anton-vlasenko force-pushed the fix/wp-term-remove-dynamic-property branch from 24f1e96 to 993587a Compare September 19, 2023 18:21
Comment on lines 314 to 389
* @coversNothing
*
* @param stdClass $actual An instance of stdClass containing the values to initialize the WP_Term object.
* @param array $expected An array containing the expected values for the WP_Term object.
*
* @dataProvider data_get_raw_data_should_return_correct_values
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @coversNothing
*
* @param stdClass $actual An instance of stdClass containing the values to initialize the WP_Term object.
* @param array $expected An array containing the expected values for the WP_Term object.
*
* @dataProvider data_get_raw_data_should_return_correct_values
* @dataProvider data_get_raw_data_should_return_correct_values
*
* @param stdClass $actual An instance of stdClass containing the values to initialize the WP_Term object.
* @param array $expected An array containing the expected values for the WP_Term object.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review, @mukeshpanchal27.
I agree with the proposed changes; however, I don't think the @covers tag should be removed.
Fixed in 0e8df1a

@anton-vlasenko anton-vlasenko force-pushed the fix/wp-term-remove-dynamic-property branch from e6e9171 to 6ac4bff Compare September 25, 2023 20:02
anton-vlasenko added a commit to anton-vlasenko/wordpress-develop that referenced this pull request Sep 25, 2023
@anton-vlasenko
Copy link
Author

Thank you for the code review, @mukeshpanchal27.
I have resolved the merge conflict and addressed the feedback from the code review.
The PR is now ready for consideration.

anton-vlasenko and others added 6 commits October 25, 2023 11:22
The WP_Term class employs the __get magic method to compute the object data.
However, since PHP 8.2 does not support dynamic properties, it is better to eliminate this approach.
Fix indentation.

Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
@anton-vlasenko anton-vlasenko force-pushed the fix/wp-term-remove-dynamic-property branch from caef2fc to 4059886 Compare October 25, 2023 09:23
@anton-vlasenko
Copy link
Author

I'm closing this PR as the solution needs more refinement.

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