Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(customization): explain how to customize the php-cs-fixer-config on the project side #25

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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