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

Order imports alphabetically #10

Merged
merged 2 commits into from Oct 17, 2022
Merged

Order imports alphabetically #10

merged 2 commits into from Oct 17, 2022

Conversation

come-nc
Copy link
Contributor

@come-nc come-nc commented Oct 17, 2022

It seems phpstorm does not sort the use statements the same way as sort, and other editors may do yet something else.
So I propose to force the order in the coding standard so that the diff make sense and we do not argue about the order.

Signed-off-by: Côme Chilliet come.chilliet@nextcloud.com

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
@come-nc come-nc self-assigned this Oct 17, 2022
@come-nc
Copy link
Contributor Author

come-nc commented Oct 17, 2022

I’m a bit sad to see that phpcs sides with phpstorm on this one and does not follow sort order.
But thankfully there is no option for changing that so we cannot argue about it.

What there is an option for is wether special kind of import should be sorted separately, I would vote for using it and not mix use function with use

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

I'm okay with this

@nickvergessen
Copy link
Member

nickvergessen commented Oct 17, 2022

What there is an option for is wether special kind of import should be sorted separately, I would vote for using it and not mix use function with use

So like PSR12?
https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/import/ordered_imports.rst#rule-sets

Fine with that as well:

['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha']

@come-nc
Copy link
Contributor Author

come-nc commented Oct 17, 2022

What there is an option for is wether special kind of import should be sorted separately, I would vote for using it and not mix use function with use

So PSR12? https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/import/ordered_imports.rst#rule-sets

Fine with that as well.

No, alpha sorting order, PSR12 seems to be none.
But yeah order ['class', 'function', 'const'] like PSR12 is fine by me, I will push that.

src/Config.php Outdated Show resolved Hide resolved
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Signed-off-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
@come-nc come-nc merged commit 88d3ffd into master Oct 17, 2022
@delete-merged-branch delete-merged-branch bot deleted the fix/ordered_imports branch October 17, 2022 14:04
@come-nc
Copy link
Contributor Author

come-nc commented Oct 17, 2022

@ChristophWurst I suppose we should tag a new release for this to be deployed on the other repos?
Could you tag it?

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.

None yet

3 participants