https://github.com/eliashaeussler/php-cs-fixer-config
π My personal configuration for PHP-CS-Fixer
https://github.com/eliashaeussler/php-cs-fixer-config
config php-cs-fixer rules
Last synced: 12 months ago
JSON representation
π My personal configuration for PHP-CS-Fixer
- Host: GitHub
- URL: https://github.com/eliashaeussler/php-cs-fixer-config
- Owner: eliashaeussler
- License: gpl-3.0
- Created: 2023-02-18T21:44:43.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-07-06T05:31:16.000Z (12 months ago)
- Last Synced: 2025-07-06T06:35:42.918Z (12 months ago)
- Topics: config, php-cs-fixer, rules
- Language: PHP
- Homepage:
- Size: 788 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# PHP-CS-Fixer config
[](https://coveralls.io/github/eliashaeussler/php-cs-fixer-config)
[](https://codeclimate.com/github/eliashaeussler/php-cs-fixer-config/maintainability)
[](https://github.com/eliashaeussler/php-cs-fixer-config/actions/workflows/cgl.yaml)
[](https://github.com/eliashaeussler/php-cs-fixer-config/actions/workflows/tests.yaml)
[](https://packagist.org/packages/eliashaeussler/php-cs-fixer-config)
This package contains basic [PHP-CS-Fixer](https://github.com/PHP-CS-Fixer/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
[](https://packagist.org/packages/eliashaeussler/php-cs-fixer-config)
[](https://packagist.org/packages/eliashaeussler/php-cs-fixer-config)
```bash
composer require eliashaeussler/php-cs-fixer-config
```
## β‘ Usage
Configure PHP-CS-Fixer in your `.php-cs-fixer.php` file:
```php
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)](LICENSE).