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

[5.1] Updating php-cs-fixer and php_codesniffer to latest versions #42603

Merged
merged 21 commits into from Feb 24, 2024

Conversation

Hackwar
Copy link
Member

@Hackwar Hackwar commented Jan 4, 2024

Summary of Changes

This updates php-cs-fixer and php_codesniffer to the latest versions respectively. I'd like to do this now since that removes a deprecated package.

Testing Instructions

Everything should behave like before.

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

@Hackwar The composer.lock shows much more being updated than only what the description of this PR says. Is that the result of a plain composer update statement? This means you update all dependencies. Or have you explicitly only made a composer update friendsofphp/php-cs-fixer?

@Hackwar
Copy link
Member Author

Hackwar commented Jan 4, 2024

I did a composer update friendsofphp/php-cs-fixer --with-all-dependencies, since otherwise it doesn't update. That is also the reason why this is aimed at 5.1-dev and not 5.0-dev.

@Hackwar
Copy link
Member Author

Hackwar commented Jan 5, 2024

I merged the necessary codestyle changes into this PR as well. No need to keep 2 PRs open for this...

@richard67
Copy link
Member

@Hackwar @brianteeman 's comment in the other, closed PR is still valid for this PR here, and I agree with him: #42604 (comment) .

For "elseif" or "case" statements, the comments are before the corresponding "elseif" or case". The CS fixer now intends them by 4 more spaces because it assumes that these comments are referring to the actual "if" or "elseif" or "case" and not the one starting in the line below.

E.g. for "elseif" in file administrator/components/com_categories/src/Model/CategoriesModel.php in line 267 and 268:

            // Case: Using only the by level filter
        } elseif ($level) {

Or for the "case" in file administrator/components/com_finder/src/Indexer/Adapter.php in lines 929 and 930:

                // Archived items should only show up when option is enabled
            case 2:
                if ($this->params->get('search_archived', 1) == 0) {

It would be better readable if we would move these comments to the line below where they belong to, e.g. for "elseif" in file administrator/components/com_categories/src/Model/CategoriesModel.php:

        } elseif ($level) {
            // Case: Using only the by level filter

Or for the "case" in file administrator/components/com_finder/src/Indexer/Adapter.php:

            case 2:
                // Archived items should only show up when option is enabled
                if ($this->params->get('search_archived', 1) == 0) {

That's just a suggestion, I would not insist on it, and I know it requires some manual work.

But I think the better readability would make it be worth the work.

@LadySolveig LadySolveig added this to the Joomla! 5.1.0 milestone Jan 5, 2024
@Quy
Copy link
Contributor

Quy commented Jan 13, 2024

* Use "no_trailing_comma_in_singleline" instead of deprecated "no_trailing_comma_in_list_call"
* fixes after replacing deprecated rule 'no_trailing_comma_in_list_call' with 'no_trailing_comma_in_singleline'
@LadySolveig
Copy link
Contributor

PR phpcs fix

PR php-cs-fixer configuration update - deprecated rule
I can also do a completely separate PR for this, but I actually think it's part of the update.

php-cs-fixer configuration update - deprecated rule
Fix phpcs - Blank line at end of control structure
@Quy
Copy link
Contributor

Quy commented Jan 15, 2024

I have tested this item ✅ successfully on 9760312


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

Copy link
Contributor

@wilsonge wilsonge left a comment

Choose a reason for hiding this comment

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

Code review looks fine. I think if either of the symfony upgrades did anything we'd have bigger problems plus system tests would pick it up as they're much deeper libraries

@laoneo
Copy link
Member

laoneo commented Jan 17, 2024

Just a not here, I did always do the composer update and then composer bump. Like that are the versions in the composer.json also updated.
As CS Fixer released 3.47.1 yesterday, you can update it already or we can do it then in beta.

@LadySolveig
Copy link
Contributor

Thanks @laoneo for the new version hint for CS Fixer - updated.

@brianteeman
Copy link
Contributor

Not addressing #42603 (comment) ??

@richard67
Copy link
Member

Not addressing #42603 (comment) ??

It was partly addressed. Some "case" statements have been fixed, but none of the "elseifs" or "else".

@richard67
Copy link
Member

@LadySolveig Since your last commit, this PR has conflicts. And the issue which I had mentioned with my big comment has been addressed only partly, see my previous comment.

@LadySolveig
Copy link
Contributor

@richard it is not very clear to me why you did not address this when @Razzo1987 contacted you directly when he has done the manually clean up here 620d3e0

could you please clean up the the remaining comments for the elseif and else yourself @Hackwar

@richard67
Copy link
Member

@richard it is not very clear to me why you did not address this when @Razzo1987 contacted you directly when he has done the manually clean up here 620d3e0

@LadySolveig Well I saw it was dealing only with the “case” statements so I assumed the other things will be done later. My first comment was very clear, I think.

@brianteeman
Copy link
Contributor

Unfortunately doing it directly without a pr (not good practice) has already been partially undone by subsequent pull requests eg #42667

@LadySolveig
Copy link
Contributor

LadySolveig commented Jan 19, 2024

I am not sure if I have understood you correctly, but I resolved the conflicts yesterday and made sure that the fixes for the comments remain as @Razzo1987 has already fixed them for us. @brianteeman have I overlooked something here somewhere?
Sorry, I see what you mean, that was my mistake that I pushed it directly

@richard67 I had the impression that we agreed here in the discussion with the maintainers that it would be easier to fix this directly here in the PR. But if the opinion has changed here I will merge and we will fix the rest later as you suggested in your comment.

@richard67
Copy link
Member

@LadySolveig Sorry in case if I’ve caused some confusion. Yes, it would be easier to fix it now, but we can do that also later. I don’t insist in my suggestions and am ok with merging the PR.

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.

rest looks ok by code review

@Hackwar
Copy link
Member Author

Hackwar commented Feb 5, 2024

In the meantime, both codestyle packages have released new versions...

@LadySolveig LadySolveig merged commit f8003bc into joomla:5.1-dev Feb 24, 2024
3 checks passed
@LadySolveig
Copy link
Contributor

Thank you !

@richard67 richard67 mentioned this pull request Feb 24, 2024
3 tasks
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.

None yet

10 participants