Skip to content

Commit b55cbb7

Browse files
committed
Use a shorter name for the script
1 parent c44a3b1 commit b55cbb7

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,13 @@ Be aware that this script is unable to differentiate between multiple code examp
145145
To use the tool, run it from the root of your standards repo like so:
146146
```bash
147147
# When installed as a project dependency:
148-
vendor/bin/phpcs-check-sniff-doc-code-examples
148+
vendor/bin/phpcs-check-doc-examples
149149

150150
# When installed globally with Composer:
151-
phpcs-check-sniff-doc-code-examples
151+
phpcs-check-doc-examples
152152

153153
# When installed as a git clone or otherwise:
154-
php path/to/PHPCSDevTools/bin/phpcs-check-sniff-doc-code-examples
154+
php path/to/PHPCSDevTools/bin/phpcs-check-doc-examples
155155
```
156156

157157
If all is good, the script will exit with code 0 and no output.

Scripts/DocCodeExamples/Config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class Config
7575
private $helpTexts = [
7676
// phpcs:disable Generic.Files.LineLength.TooLong
7777
'Usage' => [
78-
['text' => 'phpcs-check-sniff-doc-code-examples'],
79-
['text' => 'phpcs-check-sniff-doc-code-examples [--exclude=<dir>] [--ignore-sniffs=<sniff1,sniff2>] [directories|files]'],
78+
['text' => 'phpcs-check-doc-examples'],
79+
['text' => 'phpcs-check-doc-examples [--exclude=<dir>] [--ignore-sniffs=<sniff1,sniff2>] [directories|files]'],
8080
],
8181
'Options' => [
8282
[

Tests/DocCodeExamples/ConfigTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static function dataGetProperty(): array
123123
*/
124124
public function testProcessCliCommandUnsupportedArgument(string $unsupportedArgument)
125125
{
126-
$_SERVER['argv'] = \explode(' ', "./phpcs-check-sniff-doc-code-examples $unsupportedArgument");
126+
$_SERVER['argv'] = \explode(' ', "./phpcs-check-doc-examples $unsupportedArgument");
127127

128128
$this->expectException('RuntimeException');
129129
$this->expectExceptionMessage("Unsupported argument $unsupportedArgument");
@@ -161,7 +161,7 @@ public function testProcessInvalidTargetThrowException()
161161
$this->expectException('RuntimeException');
162162
$this->expectExceptionMessage('Target path ./doesnotexist does not exist');
163163

164-
$_SERVER['argv'] = ['phpcs-check-sniff-doc-code-examples', './doesnotexist'];
164+
$_SERVER['argv'] = ['phpcs-check-doc-examples', './doesnotexist'];
165165
new Config($this->writer);
166166
}
167167

@@ -202,7 +202,7 @@ public static function dataProcessCliCommand(): array
202202

203203
$testData = [
204204
'No arguments at all - verify target dir will be set to project root' => [
205-
'command' => './phpcs-check-sniff-doc-code-examples',
205+
'command' => './phpcs-check-doc-examples',
206206
'expectedChanged' => [
207207
'projectRoot' => $projectRoot,
208208
'targetPaths' => [
@@ -211,7 +211,7 @@ public static function dataProcessCliCommand(): array
211211
],
212212
],
213213
'No arguments at all and trailing whitespace in the command' => [
214-
'command' => './phpcs-check-sniff-doc-code-examples ',
214+
'command' => './phpcs-check-doc-examples ',
215215
'expectedChanged' => [
216216
'projectRoot' => $projectRoot,
217217
'targetPaths' => [
@@ -220,7 +220,7 @@ public static function dataProcessCliCommand(): array
220220
],
221221
],
222222
'No arguments other than a path' => [
223-
'command' => './phpcs-check-sniff-doc-code-examples .',
223+
'command' => './phpcs-check-doc-examples .',
224224
'expectedChanged' => [
225225
'projectRoot' => $projectRoot,
226226
'targetPaths' => [
@@ -229,7 +229,7 @@ public static function dataProcessCliCommand(): array
229229
],
230230
],
231231
'No arguments other than multiple valid paths in varying formats' => [
232-
'command' => './phpcs-check-sniff-doc-code-examples ./PHPCSDebug ./Tests bin ' . __DIR__ . '/../../.github/',
232+
'command' => './phpcs-check-doc-examples ./PHPCSDebug ./Tests bin ' . __DIR__ . '/../../.github/',
233233
'expectedChanged' => [
234234
'projectRoot' => $projectRoot,
235235
'targetPaths' => [
@@ -241,7 +241,7 @@ public static function dataProcessCliCommand(): array
241241
],
242242
],
243243
'Multiple excludes, varying formats' => [
244-
'command' => './phpcs-check-sniff-doc-code-examples .'
244+
'command' => './phpcs-check-doc-examples .'
245245
. ' --exclude=.git,./.github/,Tests/FeatureComplete,/node_modules/,tests/notvalid,../../levelup',
246246
'expectedChanged' => [
247247
'projectRoot' => $projectRoot,
@@ -259,7 +259,7 @@ public static function dataProcessCliCommand(): array
259259
],
260260
],
261261
'Exclude, complete value wrapped in quotes' => [
262-
'command' => './phpcs-check-sniff-doc-code-examples --exclude=".git,./.github/,Tests/FeatureComplete"',
262+
'command' => './phpcs-check-doc-examples --exclude=".git,./.github/,Tests/FeatureComplete"',
263263
'expectedChanged' => [
264264
'projectRoot' => $projectRoot,
265265
'targetPaths' => [
@@ -273,7 +273,7 @@ public static function dataProcessCliCommand(): array
273273
],
274274
],
275275
'Exclude, no value' => [
276-
'command' => './phpcs-check-sniff-doc-code-examples --exclude=',
276+
'command' => './phpcs-check-doc-examples --exclude=',
277277
'expectedChanged' => [
278278
'projectRoot' => $projectRoot,
279279
'targetPaths' => [
@@ -283,7 +283,7 @@ public static function dataProcessCliCommand(): array
283283
],
284284
],
285285
'Single sniff to ignore' => [
286-
'command' => './phpcs-check-sniff-doc-code-examples --ignore-sniffs=Generic.CodeAnalysis.EmptyStatement',
286+
'command' => './phpcs-check-doc-examples --ignore-sniffs=Generic.CodeAnalysis.EmptyStatement',
287287
'expectedChanged' => [
288288
'projectRoot' => $projectRoot,
289289
'targetPaths' => [
@@ -295,7 +295,7 @@ public static function dataProcessCliCommand(): array
295295
],
296296
],
297297
'Multiple sniffs to ignore wrapped in quotes' => [
298-
'command' => "./phpcs-check-sniff-doc-code-examples --ignore-sniffs='Generic.CodeAnalysis.EmptyStatement,Squiz.ControlStructures.ForEachLoopDeclaration,Squiz.Arrays.ArrayDeclaration'",
298+
'command' => "./phpcs-check-doc-examples --ignore-sniffs='Generic.CodeAnalysis.EmptyStatement,Squiz.ControlStructures.ForEachLoopDeclaration,Squiz.Arrays.ArrayDeclaration'",
299299
'expectedChanged' => [
300300
'projectRoot' => $projectRoot,
301301
'targetPaths' => [
@@ -309,7 +309,7 @@ public static function dataProcessCliCommand(): array
309309
],
310310
],
311311
'All together now, includes testing for handling of additional whitespace between arguments' => [
312-
'command' => 'phpcs-check-sniff-doc-code-examples Scripts --exclude=ignoreme,/other,./tests/'
312+
'command' => 'phpcs-check-doc-examples Scripts --exclude=ignoreme,/other,./tests/'
313313
. ' --ignore-sniffs=Generic.CodeAnalysis.EmptyStatement PHPCSDebug ./Tests .',
314314
'expectedChanged' => [
315315
'projectRoot' => $projectRoot,
@@ -330,7 +330,7 @@ public static function dataProcessCliCommand(): array
330330
],
331331
],
332332
'Help argument' => [
333-
'command' => './phpcs-check-sniff-doc-code-examples --help',
333+
'command' => './phpcs-check-doc-examples --help',
334334
'expectedChanged' => [
335335
'projectRoot' => $projectRoot,
336336
'executeCheck' => false,
@@ -341,7 +341,7 @@ public static function dataProcessCliCommand(): array
341341
// Windows only test: verify that the paths are normalized to use forward slashes.
342342
if (\DIRECTORY_SEPARATOR === '\\') {
343343
$testData['Target paths and excluded dirs paths normalized to use forward slashes'] = [
344-
'command' => 'phpcs-check-sniff-doc-code-examples Scripts\DocCodeExamples Tests\Fixtures\DocCodeExamples'
344+
'command' => 'phpcs-check-doc-examples Scripts\DocCodeExamples Tests\Fixtures\DocCodeExamples'
345345
. ' --exclude=Scripts\Utils,Tests\Fixtures\DocsXsd',
346346
'expectedChanged' => [
347347
'projectRoot' => $projectRoot,
@@ -367,14 +367,14 @@ public static function dataProcessCliCommand(): array
367367
*/
368368
public function testHelpOutput()
369369
{
370-
$_SERVER['argv'] = ['phpcs-check-sniff-doc-code-examples', '--help'];
370+
$_SERVER['argv'] = ['phpcs-check-doc-examples', '--help'];
371371
new Config($this->writer);
372372

373373
$output = $this->writer->getStdout();
374374

375375
// Just check that a key element in the help text is displayed.
376376
$this->assertStringContainsString('Usage:', $output);
377-
$this->assertStringContainsString('phpcs-check-sniff-doc-code-examples', $output);
377+
$this->assertStringContainsString('phpcs-check-doc-examples', $output);
378378
}
379379

380380
/**

Tests/DocCodeExamples/EndToEndTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use PHPUnit\Framework\Attributes\CoversNothing;
1515

1616
/**
17-
* End-to-end test for the phpcs-check-sniff-doc-code-examples script.
17+
* End-to-end test for the phpcs-check-doc-examples script.
1818
*/
1919
#[CoversNothing]
2020
final class EndToEndTest extends IOTestCase
@@ -24,7 +24,7 @@ final class EndToEndTest extends IOTestCase
2424
*
2525
* @var string
2626
*/
27-
const SCRIPT_PATH = 'bin/phpcs-check-sniff-doc-code-examples';
27+
const SCRIPT_PATH = 'bin/phpcs-check-doc-examples';
2828

2929
/**
3030
* Path to PHPCS.
File renamed without changes.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
},
5656
"bin": [
5757
"bin/phpcs-check-feature-completeness",
58-
"bin/phpcs-check-sniff-doc-code-examples"
58+
"bin/phpcs-check-doc-examples"
5959
],
6060
"minimum-stability": "dev",
6161
"prefer-stable": true,

0 commit comments

Comments
 (0)