Skip to content

Commit 95d5955

Browse files
committed
Ignore case when removing duplicates from final list
1 parent 9850de4 commit 95d5955

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Config.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1691,6 +1691,21 @@ private function parseSniffCodes($input, $argument)
16911691
}
16921692
}//end foreach
16931693

1694+
$sniffs = array_reduce($sniffs, static function ($carry, $item) {
1695+
$lower = strtolower($item);
1696+
1697+
foreach ($carry as $found) {
1698+
if ($lower === strtolower($found)) {
1699+
// This sniff is already in our list.
1700+
return $carry;
1701+
}
1702+
}
1703+
1704+
$carry[] = $item;
1705+
1706+
return $carry;
1707+
}, []);
1708+
16941709
if ($errors !== []) {
16951710
$error = 'ERROR: The --'.$argument.' option only supports sniff codes.'.PHP_EOL;
16961711
$error .= 'Sniff codes are in the form "Standard.Category.Sniff"'.PHP_EOL;
@@ -1699,7 +1714,6 @@ private function parseSniffCodes($input, $argument)
16991714
$error .= '* '.implode(PHP_EOL.'* ', $errors).PHP_EOL;
17001715

17011716
if ($sniffs !== []) {
1702-
$sniffs = array_unique($sniffs);
17031717
$error .= PHP_EOL;
17041718
$error .= 'Perhaps try --'.$argument.'="'.implode(',', $sniffs).'" instead.'.PHP_EOL;
17051719
}

0 commit comments

Comments
 (0)