Skip to content

Commit

Permalink
docs(customization): explain how to customize the php-cs-fixer-config…
Browse files Browse the repository at this point in the history
… on the project side
  • Loading branch information
yannchabed committed Jun 7, 2023
1 parent 72708c4 commit ac3771d
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,43 @@ $config->setFinder($finder);
return $config;
```

### Custom configuration

You may extend these rules and apply your own extra rules.

Create a configuration file `.php-cs-fixer.dist.php` in the root of your project:

```php
<?php

$finder = PhpCsFixer\Finder::create()
->in([
__DIR__.'/src',
__DIR__.'/tests',
]);

$config = new class() extends PhpCsFixer\Config {
public function __construct()
{
parent::__construct('customized Bedrock Streaming');
$this->setRiskyAllowed(true);
}

public function getRules(): array
{
$rules = (new M6Web\CS\Config\BedrockStreaming())->getRules();

// perform updates on the rules array here

return $rules;
}
};

$config->setFinder($finder);

return $config;
```

### Git

Add `.php-cs-fixer.cache` (this is the cache file created by `php-cs-fixer`) to `.gitignore`:
Expand Down

0 comments on commit ac3771d

Please sign in to comment.