airlst / php-cs-fixer-config
PHP CS Fixer config for AirLST projects
Installs: 6 825
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- friendsofphp/php-cs-fixer: 3.64.0
Requires (Dev)
- airlst/phpstan-config: ^8.1.0
- airlst/rector-config: ^4.3.5
- ergebnis/composer-normalize: ^2.43
README
PHP CS Fixer config for AirLST projects.
Installation
You can install the package via Composer:
composer require --dev airlst/php-cs-fixer-config
Usage
Create a .php-cs-fixer.php
in the root of your project with the following contents:
<?php declare(strict_types=1); $factory = new Airlst\PhpCsFixerConfig\Factory(['src', 'tests']); return $factory->create();
The constructor of the Factory
class takes an array of paths to be scanned for PHP files and fixed. You can pass any number of paths to it.
Running CS Fixer
Run CS Fixer with the following command:
./vendor/bin/php-cs-fixer fix
PHP 8.2 support
By default, it uses PHP 8.3 as the target version. You can switch to PHP 8.2 by calling the php82()
method on the factory object:
<?php declare(strict_types=1); $factory = new Airlst\PhpCsFixerConfig\Factory(['src', 'tests']); return $factory->php82()->create();
Only PHP 8.2 and 8.3 are supported.
Custom rules
You can provide custom rules to the configuration by calling the customRules
method on the factory object.
It will add or override the existing rules provided by the factory.
<?php declare(strict_types=1); $factory = new Airlst\PhpCsFixerConfig\Factory(['src', 'tests']); return $factory ->customRules([ 'static_lambda' => true, 'no_null_property_initialization' => false, ]) ->create();
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.