Skip to content

Comments

[5.3] Use Null Coalescing Assignment Operator For Components#44878

Merged
HLeithner merged 7 commits intojoomla:5.3-devfrom
joomdonation:use-null-coalescing-operator-rector-rule
Feb 22, 2025
Merged

[5.3] Use Null Coalescing Assignment Operator For Components#44878
HLeithner merged 7 commits intojoomla:5.3-devfrom
joomdonation:use-null-coalescing-operator-rector-rule

Conversation

@joomdonation
Copy link
Contributor

Pull Request for Issue # .

Summary of Changes

This PR uses NullCoalescingOperatorRector rector rule to improve components code using ??= operator. This is done automatically by rector, no manual change included.

Testing Instructions

Code review

Actual result BEFORE applying this Pull Request

Works

Expected result AFTER applying this Pull Request

Works, with cleaner, easier to read code

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@richard67
Copy link
Member

@joomdonation Could you fix the PHPCS issues listed here? https://ci.joomla.org/joomla/joomla-cms/82216/1/7

@joomdonation
Copy link
Contributor Author

Done, thanks @richard67 . It's strange that our PHPCS has special treatment for ??= operator, not sure why it does not want to be aligned in the same way with = operator

@QuyTon
Copy link
Contributor

QuyTon commented Feb 18, 2025

I have tested this item ✅ successfully on 7045b5b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44878.

1 similar comment
@viocassel
Copy link
Contributor

I have tested this item ✅ successfully on 7045b5b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44878.

@richard67
Copy link
Member

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44878.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Feb 18, 2025
$menuitem->submenu = [];
$menuitem->class = $menuitem->img ?? '';
$menuitem->scope = $menuitem->scope ?? null;
$menuitem->scope ??= null;
Copy link
Member

Choose a reason for hiding this comment

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

code style, and the line above is basically exact the same but is not converted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed that code style before, but our PHPCS does not allow it passed, so I had to revert the fix back. We have strange behavior with PHPCS for ??= operator here.

For the line above, if you are talking about the line $menuitem->class = $menuitem->img ?? '';, then it is not the same.

Copy link
Member

Choose a reason for hiding this comment

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

ok, then we can't merge this, until cs checker is fixed. (and yes you are right above is not the same)

Copy link
Member

@HLeithner HLeithner left a comment

Choose a reason for hiding this comment

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

Code style and missing conversations, please the the full pr for missing spaces.

thanks

@HLeithner HLeithner merged commit 33c3669 into joomla:5.3-dev Feb 22, 2025
2 of 3 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Feb 22, 2025
@HLeithner
Copy link
Member

thanks

@joomdonation joomdonation deleted the use-null-coalescing-operator-rector-rule branch February 22, 2025 16:00
@QuyTon QuyTon added this to the Joomla! 5.3.0 milestone Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants