imbo/imbo-coding-standard
最新稳定版本:v2.1.1
Composer 安装命令:
composer require imbo/imbo-coding-standard
包简介
Imbo coding standard for PHP-CS-Fixer
关键字:
README 文档
README
This is the PHP coding standard for the Imbo project and all related tools. The ruleset is enforced using the PHP Coding Standards Fixer tool.
How to setup
First, add this package and php-cs-fixer as development dependencies:
composer require --dev imbo/imbo-coding-standard ^2.0 friendsofphp/php-cs-fixer
then, create a configuration file named .php-cs-fixer.php local to your repository that includes the following:
<?php declare(strict_types=1); require 'vendor/autoload.php'; $finder = (new PhpCsFixer\Finder()) ->in(__DIR__) ->append([__FILE__]); return (new Imbo\CodingStandard\Config()) ->setFinder($finder);
Adjust the paths if necessary. Now you can run the following command to check the coding standard in your project:
vendor/bin/php-cs-fixer check --diff
Add step in the GitHub workflow
All Imbo-related projects use GitHub workflows, and checking the coding standard should be a part of that workflow:
name: CI on: push jobs: php-cs-fixer: runs-on: ubuntu-latest name: Check coding standard steps: - uses: actions/checkout@v6 - uses: shivammathur/setup-php@v2 - run: composer install - run: vendor/bin/php-cs-fixer check --diff
Add scripts for Composer
All Imbo-related projects use Composer, and checking / fixing coding standard violations should be done using Composer scripts in composer.json:
{
"scripts": {
"cs": "vendor/bin/php-cs-fixer check --diff",
"cs:fix": "vendor/bin/php-cs-fixer fix --diff"
}
}
License
MIT, see LICENSE.
统计信息
- 总下载量: 3.72k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 16
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-29