Skip to content

Commit

Permalink
Revert "w"
Browse files Browse the repository at this point in the history
This reverts commit 323e076.
  • Loading branch information
realodix committed Jul 9, 2024
1 parent 323e076 commit e14de65
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 66 deletions.
64 changes: 58 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

**Realodix Relax** is built on top of [`PHP-CS-Fixer`][php-cs-fixer] and makes it simple to to sharing identical PHP CS Fixer rules across all of your projects without copy-and-pasting configuration files.


## Installation

You can install this package by using [composer](https://getcomposer.org/):
Expand All @@ -15,7 +14,6 @@ You can install this package by using [composer](https://getcomposer.org/):
composer require --dev realodix/relax
```


## Running Relax

```sh
Expand All @@ -24,7 +22,6 @@ composer require --dev realodix/relax

For more details, see PHP-CS-Fixer [documentation](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/usage.rst).


## Configuring Relax

In your PHP CS Fixer configuration file, use the following contents:
Expand Down Expand Up @@ -77,8 +74,65 @@ By default, Relax will inspect all `.php` files in your project except those in
[doc_f_laravel]: docs/finders.md#finderlaravel -->

## Advanced Configuration
See [docs/advanced_configuration.md](docs/advanced_configuration.md) for more details.

You can find the full documentation on this page:
- [PHP-CS-Fixer: Config](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/config.rst)
- [PHP-CS-Fixer: Rules](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/rules/index.rst)
- [MLocati: PHP-CS-Fixer Configurator](https://mlocati.github.io/php-cs-fixer-configurator)


```php
<?php

use Realodix\Relax\Config;
use Realodix\Relax\Finder;

// You can add or override rule set
$localRules = [
// Add rule
'array_syntax' => true,

// Add rule or override predefined rule
'visibility_required' => true,

// Override predefined rule
'braces' => false,

// Add custom fixers
'CustomFixer/rule_1' => true,
'CustomFixer/rule_2' => true,
];

$finder = Finder::create()
->in(__DIR__)
->ignoreDotFiles(false)
->exclude(['Bar'])
->notName('*.foo.php')
->append(['.php-cs-fixer.dist.php']);

return Config::create('laravel')
->setRules($localRules)
->setFinder($finder)
->setRiskyAllowed(false)
->registerCustomFixers(new \PhpCsFixerCustomFixers\CustomFixer());
```

If you wish to completely define rules locally without using existing rule sets, you can do that:

```php
<?php

use Realodix\Relax\Config;

$localRules = [
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
];

return Config::create()
->setRules($localRules);
```

## Custom Rule Set

Expand Down Expand Up @@ -116,14 +170,12 @@ use Vendor\Package\MyRuleSet;
return Config::create(new MyRuleSet());
```


## Troubleshooting

For general help and support join our [GitHub Discussions](../../discussions).

Please report bugs to the [GitHub Issue Tracker](../../issues).


## License

This package is licensed under the [MIT License](/LICENSE).
Expand Down
60 changes: 0 additions & 60 deletions docs/advanced_configuration.md

This file was deleted.

0 comments on commit e14de65

Please sign in to comment.