Skip to content

Commit

Permalink
feat: add coding style aligned
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezcasas committed Oct 23, 2023
1 parent 2d350ba commit 34e9050
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
$ecsConfig->paths([__DIR__ . '/src',]);
$ecsConfig->sets([CodelyRules::CODING_STYLE]);
// Or this if you prefer to have the code aligned
// $ecsConfig->sets([CodelyRules::CODING_STYLE_ALIGNED]);
};
```
3. Execute it:
Expand Down
1 change: 1 addition & 0 deletions src/CodelyRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
final class CodelyRules
{
public const CODING_STYLE = __DIR__ . '/coding_style.php';
public const CODING_STYLE_ALIGNED = __DIR__ . '/coding_style_aligned.php';
}
21 changes: 21 additions & 0 deletions src/coding_style_aligned.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ecsConfig): void {
$ecsConfig->ruleWithConfiguration(
BinaryOperatorSpacesFixer::class,
[
'operators' =>
[
'=' => 'align',
'=>' => 'align',
],
]
);

$ecsConfig->sets([__DIR__ . '/coding_style.php']);
};

0 comments on commit 34e9050

Please sign in to comment.