Skip to content

Commit c717371

Browse files
committed
Add brick/coding-standard
1 parent 7c13bea commit c717371

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ jobs:
2626
- name: Run Psalm
2727
run: vendor/bin/psalm --show-info=false --find-unused-psalm-suppress --no-progress
2828

29+
coding-standard:
30+
name: Coding Standard
31+
uses: brick/coding-standard/.github/workflows/coding-standard.yml@v2
32+
with:
33+
working-directory: "tools/ecs"
34+
2935
phpunit:
3036
name: PHPUnit
3137
runs-on: ubuntu-latest

.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": "v2"
4+
},
5+
"config": {
6+
"allow-plugins": {
7+
"dealerdirect/phpcodesniffer-composer-installer": false
8+
}
9+
}
10+
}

tools/ecs/ecs.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FunctionCommentSniff;
6+
use PhpCsFixer\Fixer\ClassNotation\OrderedTypesFixer;
7+
use PhpCsFixer\Fixer\Phpdoc\PhpdocTypesOrderFixer;
8+
use Symplify\EasyCodingStandard\Config\ECSConfig;
9+
10+
return static function (ECSConfig $ecsConfig): void {
11+
$ecsConfig->import(__DIR__ . '/vendor/brick/coding-standard/ecs.php');
12+
13+
$libRootPath = realpath(__DIR__ . '/../../');
14+
15+
$ecsConfig->paths(
16+
[
17+
$libRootPath . '/src',
18+
$libRootPath . '/tests',
19+
__FILE__,
20+
],
21+
);
22+
23+
$ecsConfig->skip([
24+
$libRootPath . '/tests/Classes/*.php',
25+
26+
OrderedTypesFixer::class,
27+
PhpdocTypesOrderFixer::class,
28+
29+
// fails with multiline param phpdocs
30+
FunctionCommentSniff::class . '.MissingParamName',
31+
]);
32+
};

0 commit comments

Comments
 (0)