Skip to content

Commit

Permalink
Merge pull request #25 from BedrockStreaming/docs/explain-hox-to-exte…
Browse files Browse the repository at this point in the history
…d-the-config-on-the-project-side
  • Loading branch information
yannchabed committed Jun 8, 2023
2 parents 72708c4 + ac3771d commit 2b70ca2
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 2b70ca2

Please sign in to comment.