use statements are supposed to be ordered alphabetically

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vegantriathlete created an issue. See original summary.

vegantriathlete’s picture

Assigned: vegantriathlete » Unassigned
Status: Active » Needs review
FileSize
6.68 KB
cilefen’s picture

Title: Follow coding standards » Sort use statements
Category: Bug report » Task
Parent issue: » #2571965: [meta] Fix PHP coding standards in core
Related issues: +#1791928: [policy] Coding standards for "use" statements

Hi @vegantriathlete:

Thanks for suggesting this improvement. Check out the parent issue—standards fixes are done for all of core and also must come with a phpcs rule. I think in this case there may be no such rule yet.

Chi’s picture

use statements are supposed to be ordered alphabetically

Could you please add a reference on documentation about this. Do we have officially approved coding standard for this?

vegantriathlete’s picture

@Chi: As it turns out I don't think there is an official standard about how to order use statements. I think that I got the idea that there was one when I submitted a patch for a different module and the maintainer told me to sort my use statements alphabetically.

Chi’s picture

Component: aggregator.module » other
Status: Needs review » Closed (won't fix)

@vegantriathlete That means there is notihng to fix here.

The documetnation says:

If there are multiple use declarations in a file, we do not currently have a standard about what order they should be in. However, consider code readability and do something sensible, especially if there are many use declarations.

Feel free to submit a proposal for this subject.
https://www.drupal.org/project/coding_standards

cilefen’s picture