Skip to content

Commit 299a24e

Browse files
jrfnlgsherwood
authored andcommitted
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 7db85ef commit 299a24e

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
@@ -269,7 +269,12 @@ public function explain()
269269
// one last time and clear the output buffer.
270270
$sniffs[] = '';
271271

272-
echo PHP_EOL."The $this->name standard contains $sniffCount sniffs".PHP_EOL;
272+
$summaryLine = PHP_EOL."The $this->name standard contains 1 sniff".PHP_EOL;
273+
if ($sniffCount !== 1) {
274+
$summaryLine = str_replace('1 sniff', "$sniffCount sniffs", $summaryLine);
275+
}
276+
277+
echo $summaryLine;
273278

274279
ob_start();
275280

0 commit comments

Comments
 (0)