Skip to content

Commit

Permalink
feat: simplify api
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezcasas committed Oct 23, 2023
1 parent 34e9050 commit 9178d43
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
```
2. Add it to your `ecs.php` file:
```php
use CodelyTv\CodingStyle\CodelyRules;
use CodelyTv\CodingStyle;
use Symplify\EasyCodingStandard\Config\ECSConfig;
return function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([__DIR__ . '/src',]);
$ecsConfig->sets([CodelyRules::CODING_STYLE]);
$ecsConfig->sets([CodingStyle::DEFAULT]);
// Or this if you prefer to have the code aligned
// $ecsConfig->sets([CodelyRules::CODING_STYLE_ALIGNED]);
// $ecsConfig->sets([CodingStyle::ALIGNED]);
};
```
3. Execute it:
Expand Down
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
"type": "library",
"keywords": ["static analysis", "code style"],
"license": "AGPL-3.0-or-later",
"authors": [
{
"name": "Codely",
"homepage": "https://codely.com"
}
],
"autoload": {
"psr-4": {
"CodelyTv\\CodingStyle\\": "src/"
"CodelyTv\\": "src/"
}
},
"require": {
Expand Down
4 changes: 2 additions & 2 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

use CodelyTv\CodingStyle\CodelyRules;
use CodelyTv\CodingStyle;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([__DIR__ . '/src',]);

$ecsConfig->sets([CodelyRules::CODING_STYLE]);
$ecsConfig->sets([CodingStyle::DEFAULT]);
};
11 changes: 0 additions & 11 deletions src/CodelyRules.php

This file was deleted.

11 changes: 11 additions & 0 deletions src/CodingStyle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace CodelyTv;

final class CodingStyle
{
public const DEFAULT = __DIR__ . '/coding_style.php';
public const ALIGNED = __DIR__ . '/coding_style_aligned.php';
}

0 comments on commit 9178d43

Please sign in to comment.