Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

πŸ““ Provides a configuration factory and multiple rule sets for friendsofphp/php-cs-fixer.

License

Notifications You must be signed in to change notification settings

realodix/PHP-CS-Fixer-Config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

❗ Abandoned!

This package is abandoned, you should avoid using it. Use realodix/relax instead.

php-cs-fixer-config

PHPVersion Build Status GitHub license

Provides a configuration factory and multiple rule sets for friendsofphp/php-cs-fixer.

Installation

You can install the package via composer:

composer require --dev realodix/php-cs-fixer-config

Usage

Configuration

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);

Configuration with override rules

πŸ’‘ 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

Configuration with header

πŸ’‘ 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
 */

License

This package is licensed using the MIT License.

Credits

This project is inspired by and also replaces ergebnis/php-cs-fixer-config.

About

πŸ““ Provides a configuration factory and multiple rule sets for friendsofphp/php-cs-fixer.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages