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

feature: BlankLineBetweenImportGroupsFixer - Introduction #6365

Conversation

SanderVerkuil
Copy link
Contributor

Closes #4821

I've also updated the PSR12 set to include this rule, to be compliant with the PSR12.

Copy link
Member

@julienfalque julienfalque left a comment

Choose a reason for hiding this comment

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

Awesome! Just a few nitpicks and this can be merged IMO.

@SpacePossum SpacePossum changed the title Blank line between import groups BlankLineBetweenImportGroupsFixer - Introduction May 13, 2022
@SanderVerkuil
Copy link
Contributor Author

@SpacePossum and/or @keradus, sorry for the ping. This is my first pull request to contribute to the amazing PHP CS Fixer, and I was wondering what further needs to be done to get this approved and being used upstream?

@SpacePossum
Copy link
Contributor

The PR already looks great, I left a little review PR on your fork to deal some edge cases where the fixer would break the code, let me know what you think.

@julienfalque
Copy link
Member

Hi @SanderVerkuil. Some tests are failing, can you please fix them? Then we can merge :)

@SanderVerkuil
Copy link
Contributor Author

Hi @SanderVerkuil. Some tests are failing, can you please fix them? Then we can merge :)

Hmn, @SpacePossum added some tests where comments have been added within the use import statement, like:

use Weird\Be/**comment*/hat;

Which is apparently correct php in some cases, but not all.

The errors are regarding PHP syntax errors, and used to run fine on PHP 7 if I recall correctly, but apparently break on PHP 8.1. Should I just remove those test cases (as the error is that it's a PHP syntax error), or only test these cases in PHP 7?

@julienfalque
Copy link
Member

Not sure this test has much value if it is only valid on a PHP version that we'll likely stop supporting soon anyway. I would remove it. What do you think @SpacePossum?

@SpacePossum
Copy link
Contributor

SpacePossum commented Jun 18, 2022

The failure on 7.4 are a priority test/fixture issue in here:

https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/6761749e9c651f15ae58e42cd82c76cbb61fdf00/tests/Fixtures/Integration/priority/ordered_imports%2Cblank_line_between_import_groups.test#L26

So lets see what is up with that.

Than lets move the use Weird\Be/**comment*/hat; to a dedicated test method

    /**
     * @requires PHP <8.0
     */

, as I don't know what the planning is for dropping 7.4 support but my guess is it might be for a while

@SpacePossum
Copy link
Contributor

SpacePossum commented Jun 19, 2022

please consider: SanderVerkuil#2
if happy please merge, than rebase and squash this PR into one commit with only you as author,
please update the title of the PR to start with feature:
thanks!

@SanderVerkuil
Copy link
Contributor Author

@SpacePossum Will do that as soon as I'm home tomorrow 💪. Thanks for your help and support! Now only another approval for the tests and I'll happily squash all commits

@coveralls
Copy link

coveralls commented Jun 19, 2022

Coverage Status

Coverage increased (+0.006%) to 92.879% when pulling 36c2d6b on SanderVerkuil:fix/issue-4821/blank-line-between-import-groups into 7936fb2 on FriendsOfPHP:master.

@julienfalque julienfalque changed the title BlankLineBetweenImportGroupsFixer - Introduction feature: BlankLineBetweenImportGroupsFixer - Introduction Jun 19, 2022
In combination with the grouped use statements, PHP-CS-Fixer fully
supports the PSR12 guidelines for the use statements.
@SanderVerkuil SanderVerkuil force-pushed the fix/issue-4821/blank-line-between-import-groups branch from 42d83bb to 36c2d6b Compare June 20, 2022 14:44
@SanderVerkuil
Copy link
Contributor Author

@SpacePossum The commits have been rebased and squashed, and is now a single commit. Thanks for all the help, let's hope this will be merged soon 🤞

@SpacePossum
Copy link
Contributor

SpacePossum commented Jun 20, 2022

Thanks! : D Hope it will ship soon as well :)

@julienfalque julienfalque merged commit b513fb7 into PHP-CS-Fixer:master Jun 21, 2022
@julienfalque
Copy link
Member

Thank you @SanderVerkuil.

@Wirone Wirone mentioned this pull request Sep 13, 2024
10 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.

Empty line between import groups
6 participants