@@ -60,7 +60,9 @@ Now you will be able to run the fix using `composer analyze` and execute automat
6060### Add custom checks or override default settings
6161
6262On top of the default code-style rules, you are free to add any rules from [ PHP-CS-Fixer] or [ PHP_CodeSniffer] .
63- If needed, you can also override some default settings.
63+ If needed, you can also override any default settings.
64+
65+ Below find examples of some more opinionated checks you may want to add depending on your needs:
6466
6567``` php
6668<?php declare(strict_types=1);
@@ -76,10 +78,20 @@ return ECSConfig::configure()
7678 __DIR__ . '/vendor/lmc/coding-standard/ecs.php',
7779 ]
7880 )
79- // Enforce line-length to 120 characters
81+ ->withRules(
82+ [
83+ // PHPUnit attributes must be used over their respective PHPDoc-based annotations. (Use with PHPUnit 10+.)
84+ PhpUnitAttributesFixer::class,
85+ // Single-line comments must have proper spacing.
86+ SingleLineCommentSpacingFixer::class,
87+ ]
88+ )
89+ // Enforce line-length to 120 characters.
8090 ->withConfiguredRule(LineLengthSniff::class, ['absoluteLineLimit' => 120])
81- // Tests must have @test annotation
82- ->withConfiguredRule(PhpUnitTestAnnotationFixer::class, ['style' => 'annotation']);
91+ // Tests must have @test annotation.
92+ ->withConfiguredRule(PhpUnitTestAnnotationFixer::class, ['style' => 'annotation'])
93+ // Specify elements separation.
94+ ->withConfiguredRule(ClassAttributesSeparationFixer::class, ['elements' => ['const' => 'none', 'method' => 'one', 'property' => 'none']])
8395 /* (...) */
8496```
8597
0 commit comments