Skip to content

Commit 34e9050

Browse files
committed
feat: add coding style aligned
1 parent 2d350ba commit 34e9050

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
$ecsConfig->paths([__DIR__ . '/src',]);
3737
3838
$ecsConfig->sets([CodelyRules::CODING_STYLE]);
39+
40+
// Or this if you prefer to have the code aligned
41+
// $ecsConfig->sets([CodelyRules::CODING_STYLE_ALIGNED]);
3942
};
4043
```
4144
3. Execute it:

src/CodelyRules.php

+1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
final class CodelyRules
88
{
99
public const CODING_STYLE = __DIR__ . '/coding_style.php';
10+
public const CODING_STYLE_ALIGNED = __DIR__ . '/coding_style_aligned.php';
1011
}

src/coding_style_aligned.php

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;
6+
use Symplify\EasyCodingStandard\Config\ECSConfig;
7+
8+
return static function (ECSConfig $ecsConfig): void {
9+
$ecsConfig->ruleWithConfiguration(
10+
BinaryOperatorSpacesFixer::class,
11+
[
12+
'operators' =>
13+
[
14+
'=' => 'align',
15+
'=>' => 'align',
16+
],
17+
]
18+
);
19+
20+
$ecsConfig->sets([__DIR__ . '/coding_style.php']);
21+
};

0 commit comments

Comments
 (0)