Skip to content

Commit 7e59eeb

Browse files
committed
Docs: Update usage in readme
1 parent 7af709f commit 7e59eeb

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,19 @@ composer require --dev lmc/coding-standard
2525
use Symplify\EasyCodingStandard\Config\ECSConfig;
2626

2727
return ECSConfig::configure()
28+
->withPaths([__DIR__ . '/src', __DIR__ . '/tests']) // optionally add 'config' or other directories with PHP files
29+
->withRootFiles() // to include ecs.php and all other php files in the root directory
2830
->withSets(
2931
[
3032
__DIR__ . '/vendor/lmc/coding-standard/ecs.php',
3133
]
3234
);
3335

3436
// Be default only checks compatible with PHP 8.0 are enabled.
35-
// Depending on the lowest PHP version your project need to support, you can enable additional checks for
36-
// PHP 8.1, 8.2 and 8.3.
37+
// Depending on the lowest PHP version your project needs to support, you can enable additional checks.
3738

38-
39-
// Import one of ecs-8.1.php, ecs-8.2.php or ecs-8.3.php. Use only one file (for the highest possible PHP version).
39+
// Import one of ecs-8.1.php, ecs-8.2.php or ecs-8.3.php. Use only one additional file (for the highest possible
40+
// PHP version), the configs for previous versions are automatically included.
4041
//->withSets(
4142
// [
4243
// __DIR__ . '/vendor/lmc/coding-standard/ecs.php',
@@ -45,23 +46,23 @@ return ECSConfig::configure()
4546
//);
4647
```
4748

48-
2. Run the check command (for `src/` and `tests/` directories):
49+
2. Run the check command
4950

5051
```bash
51-
vendor/bin/ecs check src/ tests/
52+
vendor/bin/ecs check
5253
```
5354

5455
3. Optionally we recommend adding this to `scripts` section of your `composer.json`:
5556

5657
```json
5758
"scripts": {
5859
"analyze": [
59-
"vendor/bin/ecs check src/ tests/ --ansi",
60+
"vendor/bin/ecs check --ansi",
6061
"[... other scripts, like PHPStan etc.]"
6162
],
6263
"fix": [
6364
"...",
64-
"vendor/bin/ecs check ./src/ ./tests/ --ansi --fix"
65+
"vendor/bin/ecs check --ansi --fix"
6566
],
6667
}
6768
```
@@ -83,6 +84,7 @@ use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer;
8384
use Symplify\EasyCodingStandard\Config\ECSConfig;
8485

8586
return ECSConfig::configure()
87+
/* (...) */
8688
->withSets(
8789
[
8890
__DIR__ . '/vendor/lmc/coding-standard/ecs.php',
@@ -92,6 +94,7 @@ return ECSConfig::configure()
9294
->withConfiguredRule(LineLengthSniff::class, ['absoluteLineLimit' => 120])
9395
// Tests must have @test annotation
9496
->withConfiguredRule(PhpUnitTestAnnotationFixer::class, ['style' => 'annotation']);
97+
/* (...) */
9598
```
9699

97100
See [EasyCodingStandard docs](https://github.com/symplify/easy-coding-standard#configuration) for more configuration options.
@@ -111,6 +114,7 @@ use PHP_CodeSniffer\Standards\Squiz\Sniffs\Arrays\ArrayDeclarationSniff;
111114
use Symplify\EasyCodingStandard\Config\ECSConfig;
112115

113116
return ECSConfig::configure()
117+
/* (...) */
114118
->withSkip([
115119
// Ignore specific check only in specific files
116120
ForbiddenFunctionsSniff::class => [__DIR__ . '/src-tests/bootstrap.php'],
@@ -126,6 +130,7 @@ return ECSConfig::configure()
126130
__DIR__ . '/vendor/lmc/coding-standard/ecs.php',
127131
]
128132
);
133+
/* (...) */
129134
```
130135

131136
See [EasyCodingStandard docs](https://github.com/symplify/easy-coding-standard#configuration) for more configuration options.

0 commit comments

Comments
 (0)