Skip to content

Commit 29e1e0e

Browse files
committed
chore(API-1925): Add ecs and new rules
1 parent f6f9730 commit 29e1e0e

File tree

5 files changed

+89
-17
lines changed

5 files changed

+89
-17
lines changed

.php_cs.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ cs: ## Run code style check
3737
@echo "------------------"
3838
@echo "- PHP code style -"
3939
@echo "------------------"
40-
$(DOCKER_RUN) bin/php-cs-fixer fix --diff --dry-run --config=.php_cs.php -vvv
40+
$(DOCKER_RUN) bin/ecs
4141

4242
.PHONY: fix-cs
4343
fix-cs: ## Fix PHP code style
44-
$(DOCKER_RUN) bin/php-cs-fixer fix --config=.php_cs.php
44+
$(DOCKER_RUN) bin/ecs --fix
4545

4646
.PHONY: rector
4747
rector: ## Run rector

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"donatj/mock-webserver": "^2.0",
3939
"http-interop/http-factory-guzzle": "^1.0",
4040
"php-http/guzzle6-adapter": "^2.0",
41-
"rector/rector": "^0.14.6"
41+
"rector/rector": "^0.14.6",
42+
"symplify/easy-coding-standard": "^11.1"
4243
},
4344
"config": {
4445
"bin-dir": "bin",

composer.lock

Lines changed: 56 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ecs.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
4+
use Symplify\EasyCodingStandard\Config\ECSConfig;
5+
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
6+
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
7+
use Symplify\CodingStandard\Fixer\Spacing\StandaloneLinePromotedPropertyFixer;
8+
9+
return static function (ECSConfig $ecsConfig): void {
10+
$ecsConfig->paths([
11+
__DIR__ . '/src',
12+
__DIR__ . '/tests',
13+
__DIR__ . '/spec'
14+
]);
15+
16+
$ecsConfig->sets([SetList::PSR_12]);
17+
18+
$ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, [
19+
'syntax' => 'short',
20+
]);
21+
22+
$ecsConfig->ruleWithConfiguration(LineLengthFixer::class, [
23+
LineLengthFixer::LINE_LENGTH => 140,
24+
LineLengthFixer::INLINE_SHORT_LINES => false,
25+
LineLengthFixer::BREAK_LONG_LINES => true,
26+
]);
27+
28+
$ecsConfig->rule(StandaloneLinePromotedPropertyFixer::class);
29+
};

0 commit comments

Comments
 (0)