Skip to content

Commit 631f16a

Browse files
committed
Ruleset::explain(): use natural sorting
... for the list of included sniffs. The `SORT_NATURAL` and the `SORT_FLAG_CASE` flag are available since PHP 5.4, so can be used without issue.
1 parent 16db52c commit 631f16a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ The file documents changes to the PHP_CodeSniffer project.
8383
- Thanks to @Daimona for the patch
8484
- Runtime performance improvement for PHPCS CLI users. The improvement should be most noticeable for users on Windows.
8585
- Thanks to Juliette Reinders Folmer (@jrfnl) for the patch
86+
- The -e (explain) command will now list sniffs in natural order
87+
- Thanks to Juliette Reinders Folmer (@jrfnl) for the patch
8688

8789
### Removed
8890
- Removed support for installing via PEAR

src/Ruleset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public function __construct(Config $config)
238238
public function explain()
239239
{
240240
$sniffs = array_keys($this->sniffCodes);
241-
sort($sniffs);
241+
sort($sniffs, (SORT_NATURAL | SORT_FLAG_CASE));
242242

243243
$sniffCount = count($sniffs);
244244

0 commit comments

Comments
 (0)