Skip to content

Commit da0c874

Browse files
committed
Ruleset::explain(): fix plural vs singular phrasing
When running the `phpcs --standard=Name -e` command, the line at the top of the output would always presume that a standard contains more than one sniff. The sniff count for the standards within the standard - `StandardName (# sniff[s])` - already handled this correctly. Fixed the top line now. Output without this fix: ``` The DummySubDir standard contains 1 sniffs DummySubDir (1 sniff) ---------------------- DummySubDir.Demo.Demo ``` Output with this fix: ``` The DummySubDir standard contains 1 sniff DummySubDir (1 sniff) ---------------------- DummySubDir.Demo.Demo ```
1 parent 498a939 commit da0c874

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Ruleset.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,12 @@ public function explain()
249249
// one last time and clear the output buffer.
250250
$sniffs[] = '';
251251

252-
echo PHP_EOL."The $this->name standard contains $sniffCount sniffs".PHP_EOL;
252+
$summaryLine = PHP_EOL."The $this->name standard contains 1 sniff".PHP_EOL;
253+
if ($sniffCount !== 1) {
254+
$summaryLine = str_replace('1 sniff', "$sniffCount sniffs", $summaryLine);
255+
}
256+
257+
echo $summaryLine;
253258

254259
ob_start();
255260

0 commit comments

Comments
 (0)