WordPress-Coding-Standards/WordPress-Extra
jrfnl 44a2a2d4d9 New sniff to enforce ordering of namespace use statements as per the draft PSR-12.
"If present, each of the blocks below MUST be separated by a single blank line, and MUST NOT contain a blank line.
Each block MUST be in the order listed below, although blocks that are not relevant may be omitted."

- One or more class-based use import statements.
- One or more function-based use import statements.
- One or more constant-based use import statements.

Also verifies that the use statements follow the namespace declaration.

See:  https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md (section 3)

Includes extensive unit tests.

Includes auto-fixer. As the fixes to the order have to be made in one go as they would otherwise create the most horrific fixer conflicts/running out of loops, a number of different error messages all have the same error code as otherwise disabling one errorcode would break the fixer.

Sniff has been added to the `Extra` ruleset.

Addresses 1071#issuecomment-320683697

This sniff is a candidate for pulling upstream at some point.
2018-02-09 18:23:38 +01:00
..
ruleset.xml New sniff to enforce ordering of namespace use statements as per the draft PSR-12. 2018-02-09 18:23:38 +01:00