airlst/php-cs-fixer-config
最新稳定版本:3.7.0
Composer 安装命令:
composer require airlst/php-cs-fixer-config
包简介
PHP CS Fixer config for AirLST projects
README 文档
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.3 and 8.2 support
By default, it uses PHP 8.4 as the target version. You can switch to PHP 8.3 or PHP 8.2 by calling the php83() or php82() method on the factory object:
<?php declare(strict_types=1); $factory = new Airlst\PhpCsFixerConfig\Factory(['src', 'tests']); return $factory->php83()->create(); // uses php 8.3 setting
Only PHP 8.2, 8.3 and 8.4 are supported.
Exclude directories
excludeDirectories() method can be used to exclude list of directories. Accepts array.
<?php declare(strict_types=1); $factory = new Airlst\PhpCsFixerConfig\Factory(['src', 'tests']); return $factory->excludeDirectories(['src/example_directory', 'src/example_directory_2'])->create();
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.
统计信息
- 总下载量: 18.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-31