This package is abandoned, you should avoid using it. Use realodix/relax
instead.
Provides a configuration factory and multiple rule sets for friendsofphp/php-cs-fixer
.
You can install the package via composer:
composer require --dev realodix/php-cs-fixer-config
Pick one of the rule sets:
Create a configuration file .php-cs-fixer.php
in the root of your project:
<?php
use Realodix\CsConfig\Factory;
use Realodix\CsConfig\RuleSet;
return Factory::fromRuleSet(new RuleSet\Realodix);
Not interested with the built-in rule set?
Very easy, just use Blank
rule set, then add your rules.
$yourRules = [
'your_rule_1' = true,
'your_rule_2' = true,
];
Factory::fromRuleSet(new RuleSet\Blank, $yourRules);
π‘ Optionally override rules from a rule set by passing in an array of rules to be merged in:
-Factory::fromRuleSet(new RuleSet\Realodix);
+Factory::fromRuleSet(new RuleSet\Realodix, [
+ 'no_extra_blank_lines' => false,
+]);
Built-in custom fixers
PhpStorm/braces_one_line
- kubawerlos/php-cs-fixer-custom-fixers
- pedrotroller/php-cs-custom-fixer
- Slamdunk/php-cs-fixer-extensions
- drupol/phpcsfixer-configs-drupal
Drupal/blank_line_before_end_of_class
Drupal/control_structure_braces_else
Drupal/inline_comment_spacer
Drupal/new_line_on_multiline_array
Drupal/try_catch_block
π‘ Optionally specify a header:
+$header = <<<EOF
+Copyright (c) 2021 Realodix
+
+For the full copyright and license information, please view
+the LICENSE file that was distributed with this source code.
+
+@see https://github.com/realodix/php-cs-fixer-config
+EOF;
-Factory::fromRuleSet(new RuleSet\Realodix);
+Factory::fromRuleSet(new RuleSet\Realodix($header));
This will enable and configure the HeaderCommentFixer
, so that
file headers will be added to PHP files, for example:
<?php
/**
* Copyright (c) 2021 Realodix
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://github.com/realodix/php-cs-fixer-config
*/
This package is licensed using the MIT License.
This project is inspired by and also replaces ergebnis/php-cs-fixer-config.