Skip to content

Commit ee491df

Browse files
committed
Add ECS
1 parent 80bb9db commit ee491df

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Coding Standard
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
coding-standard:
9+
name: Coding Standard
10+
uses: brick/coding-standard/.github/workflows/coding-standard.yml@main

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
/vendor
22
/composer.lock
33
/.phpunit.cache
4+
5+
/tools/*
6+
!/tools/ecs/composer.json
7+
!/tools/ecs/ecs.php

tools/ecs/composer.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"require": {
3+
"brick/coding-standard": "dev-main"
4+
},
5+
"config": {
6+
"allow-plugins": {
7+
"dealerdirect/phpcodesniffer-composer-installer": true
8+
}
9+
}
10+
}

tools/ecs/ecs.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FunctionCommentSniff;
6+
use SlevomatCodingStandard\Sniffs\Namespaces\UseSpacingSniff;
7+
use Symplify\EasyCodingStandard\Config\ECSConfig;
8+
9+
return static function (ECSConfig $ecsConfig): void {
10+
$ecsConfig->import(__DIR__ . '/vendor/brick/coding-standard/ecs.php');
11+
12+
$libRootPath = __DIR__ . '/../../';
13+
14+
$ecsConfig->paths(
15+
[
16+
$libRootPath . '/src',
17+
$libRootPath . '/tests',
18+
__FILE__,
19+
],
20+
);
21+
22+
$ecsConfig->indentation('spaces');
23+
24+
$ecsConfig->skip([
25+
// Only interested in FunctionCommentSniff.ParamCommentFullStop, excludes the rest
26+
FunctionCommentSniff::class . '.Missing' => null,
27+
FunctionCommentSniff::class . '.MissingReturn' => null,
28+
FunctionCommentSniff::class . '.MissingParamTag' => null,
29+
FunctionCommentSniff::class . '.EmptyThrows' => null,
30+
FunctionCommentSniff::class . '.IncorrectParamVarName' => null,
31+
FunctionCommentSniff::class . '.IncorrectTypeHint' => null,
32+
FunctionCommentSniff::class . '.MissingParamComment' => null,
33+
FunctionCommentSniff::class . '.ParamNameNoMatch' => null,
34+
FunctionCommentSniff::class . '.InvalidReturn' => null,
35+
36+
// Keep a line between same use types, spacing around uses is done in other fixers
37+
UseSpacingSniff::class . '.IncorrectLinesCountBeforeFirstUse' => null,
38+
UseSpacingSniff::class . '.IncorrectLinesCountAfterLastUse' => null,
39+
]);
40+
};

0 commit comments

Comments
 (0)