|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | +use PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FunctionCommentSniff; |
| 5 | +use PhpCsFixer\Fixer\ClassNotation\OrderedTypesFixer; |
| 6 | +use PhpCsFixer\Fixer\Phpdoc\PhpdocTypesOrderFixer; |
| 7 | +use SlevomatCodingStandard\Sniffs\Commenting\DocCommentSpacingSniff; |
| 8 | +use SlevomatCodingStandard\Sniffs\Namespaces\UseSpacingSniff; |
| 9 | +use SlevomatCodingStandard\Sniffs\Whitespaces\DuplicateSpacesSniff; |
| 10 | +use Symplify\EasyCodingStandard\Config\ECSConfig; |
| 11 | + |
| 12 | +return static function (ECSConfig $ecsConfig): void { |
| 13 | + $ecsConfig->import(__DIR__ . '/vendor/brick/coding-standard/ecs.php'); |
| 14 | + |
| 15 | + $libRootPath = __DIR__ . '/../../'; |
| 16 | + |
| 17 | + $ecsConfig->paths( |
| 18 | + [ |
| 19 | + $libRootPath . '/src', |
| 20 | + $libRootPath . '/tests', |
| 21 | + __FILE__, |
| 22 | + ], |
| 23 | + ); |
| 24 | + |
| 25 | + $ecsConfig->indentation('spaces'); |
| 26 | + |
| 27 | + $ecsConfig->skip([ |
| 28 | + // Only interested in FunctionCommentSniff.ParamCommentFullStop, excludes the rest |
| 29 | + FunctionCommentSniff::class . '.Missing' => null, |
| 30 | + FunctionCommentSniff::class . '.MissingReturn' => null, |
| 31 | + FunctionCommentSniff::class . '.MissingParamTag' => null, |
| 32 | + FunctionCommentSniff::class . '.EmptyThrows' => null, |
| 33 | + FunctionCommentSniff::class . '.IncorrectParamVarName' => null, |
| 34 | + FunctionCommentSniff::class . '.IncorrectTypeHint' => null, |
| 35 | + FunctionCommentSniff::class . '.MissingParamComment' => null, |
| 36 | + FunctionCommentSniff::class . '.ParamNameNoMatch' => null, |
| 37 | + FunctionCommentSniff::class . '.InvalidReturn' => null, |
| 38 | + |
| 39 | + // Allows alignment in test providers |
| 40 | + DuplicateSpacesSniff::class => [$libRootPath . '/tests'], |
| 41 | + |
| 42 | + // Keep a line between same use types, spacing around uses is done in other fixers |
| 43 | + UseSpacingSniff::class . '.IncorrectLinesCountBeforeFirstUse' => null, |
| 44 | + UseSpacingSniff::class . '.IncorrectLinesCountAfterLastUse' => null, |
| 45 | + |
| 46 | + // We want to keep BigNumber|int|float|string order |
| 47 | + OrderedTypesFixer::class => null, |
| 48 | + PhpdocTypesOrderFixer::class => null, |
| 49 | + |
| 50 | + // Fails with @ pure @ codeCoverageIgnore on successive lines |
| 51 | + DocCommentSpacingSniff::class . '.IncorrectAnnotationsGroup' => null, |
| 52 | + ]); |
| 53 | +}; |
0 commit comments