Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature request: When sorting use statements, match the sort order typically used by php-cs-fixer #105
Comments
ezzatron
referenced this issue
Sep 20, 2017
Closed
Sort use statements in a case-insensitive manner. #106
This comment has been minimized.
This comment has been minimized.
I think PHP Companion should not care of the use sorting. php-cs-fixer does that pretty well, no need to reinvent the wheel. |
erichard
added
the
wontfix
label
Jan 10, 2018
erichard
closed this
Jan 10, 2018
This comment has been minimized.
This comment has been minimized.
arxeiss
commented
Jan 18, 2019
@erichard I don't understand why this is closed... In our new project, company set rules and one of them is sorting Why this package should not contain option to turn on/off case insensitive sorting? |
This comment has been minimized.
This comment has been minimized.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ezzatron commentedSep 20, 2017
When adding use statements to a file as a result of
find_use
, PHP Companion inserts the use statement where it should appear in alphabetical order (seemingly using the top-most namespace only?).This is pretty good already, but it's not a perfect fit to how use statements are ordered by PHP-CS-Fixer's "ordered_imports" fixer.
The exact logic they use is (from here):
So the important details here are:
use
,use function
,use const
) are treated as different lists for sorting. Another way of saying this is that the use statements are sorted by type first. This is irrelevant to PHP Companion right now, but would relate to #104 if implemented.