Skip to content

Commit 9dca599

Browse files
committed
Add brick/coding-standard
1 parent 113a8ee commit 9dca599

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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@v1
11+
with:
12+
php-version: "8.2"
13+
working-directory: "tools/ecs"

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

tools/ecs/ecs.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Fixer\ClassNotation\OrderedTypesFixer;
6+
use PhpCsFixer\Fixer\Phpdoc\PhpdocTypesOrderFixer;
7+
use SlevomatCodingStandard\Sniffs\Whitespaces\DuplicateSpacesSniff;
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 = __DIR__ . '/../../';
14+
15+
$ecsConfig->paths(
16+
[
17+
$libRootPath . '/src',
18+
$libRootPath . '/tests',
19+
__FILE__,
20+
],
21+
);
22+
23+
$ecsConfig->skip([
24+
// Allows alignment in test providers
25+
DuplicateSpacesSniff::class => [$libRootPath . '/tests'],
26+
27+
// We want to keep BigNumber|int|float|string order
28+
OrderedTypesFixer::class => null,
29+
PhpdocTypesOrderFixer::class => null,
30+
]);
31+
};

0 commit comments

Comments
 (0)