eliashaeussler / php-cs-fixer-config
My personal configuration for PHP-CS-Fixer
Installs: 223 026
Dependents: 15
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: ~8.1.0 || ~8.2.0 || ~8.3.0
- friendsofphp/php-cs-fixer: ^3.14
- symfony/finder: ^5.4 || ^6.0 || ^7.0
Requires (Dev)
- armin/editorconfig-cli: ^1.5 || ^2.0
- eliashaeussler/phpstan-config: ^2.0.0
- eliashaeussler/rector-config: ^3.0
- ergebnis/composer-normalize: ^2.29
- phpstan/extension-installer: ^1.2
- phpunit/phpunit: ^10.1 || ^11.0
README
PHP-CS-Fixer config
This package contains basic PHP-CS-Fixer config for use in my personal projects. It is not meant to be used anywhere else. I won't provide support and don't accept pull requests for this repo.
🔥 Installation
composer require eliashaeussler/php-cs-fixer-config
⚡ Usage
Configure PHP-CS-Fixer in your .php-cs-fixer.php
file:
use EliasHaeussler\PhpCsFixerConfig; use Symfony\Component\Finder; // Create header rule $header = PhpCsFixerConfig\Rules\Header::create( 'eliashaeussler/package-name', PhpCsFixerConfig\Package\Type::ComposerPackage, PhpCsFixerConfig\Package\Author::create('Elias Häußler', 'elias@haeussler.dev'), PhpCsFixerConfig\Package\CopyrightRange::from(2021), PhpCsFixerConfig\Package\License::GPL3OrLater, ); // Create custom rule set $ruleSet = PhpCsFixerConfig\Rules\RuleSet::fromArray([ 'modernize_types_casting' => true, 'php_unit_test_case_static_method_calls' => [ 'call_type' => 'self', ], ]); return PhpCsFixerConfig\Config::create() ->withRule($header) ->withRule($ruleSet) // You can also overwrite all rules ->withRule($ruleSet, false) ->withFinder(static fn (Finder\Finder $finder) => $finder->in(__DIR__)) // You can also inject your own Finder instance ->withFinder($finder) ;
⭐ License
This project is licensed under GNU General Public License 3.0 (or later).