✨ 添加 php 代码风格检测配置
This commit is contained in:
parent
24920ada03
commit
733c74567d
@ -47,6 +47,7 @@
|
||||
## 其他
|
||||
* [other](other.md)
|
||||
* [常用配置](used-settings.md)
|
||||
* [编码风格](code-style.md)
|
||||
|
||||
## PHP 依赖工具
|
||||
* [Composer](composer.md)
|
||||
|
35
code-style.md
Normal file
35
code-style.md
Normal file
@ -0,0 +1,35 @@
|
||||
Git 提交 PHP 代码风格检测配置
|
||||
|
||||
```json
|
||||
{
|
||||
"require": {
|
||||
"friendsofphp/php-cs-fixer": "^2.16",
|
||||
"brainmaestro/composer-git-hooks": "^2.8"
|
||||
},
|
||||
"extra": {
|
||||
"hooks": {
|
||||
"pre-commit": [
|
||||
"composer check-style"
|
||||
],
|
||||
"post-merge": "composer install"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-update-cmd": [
|
||||
"cghooks update"
|
||||
],
|
||||
"post-install-cmd": [
|
||||
"cghooks add --ignore-lock",
|
||||
"cghooks update"
|
||||
],
|
||||
"cghooks": "vendor/bin/cghooks",
|
||||
"check-style": "php-cs-fixer fix --using-cache=no --diff --config=.php_cs --dry-run --ansi",
|
||||
"fix-style": "php-cs-fixer fix --using-cache=no --config=.php_cs --ansi"
|
||||
},
|
||||
"scripts-descriptions": {
|
||||
"check-style": "Run style checks (only dry run - no fixing!).",
|
||||
"fix-style": "Run style checks and fix violations."
|
||||
}
|
||||
}
|
||||
|
||||
```
|
@ -5,6 +5,8 @@ composer list #显示所有命令
|
||||
|
||||
composer show #显示所有包信息
|
||||
|
||||
composer info packagename #查看指定包信息
|
||||
|
||||
composer install #在 composer.json 配置中添加依赖库之后运行此命令安装
|
||||
|
||||
composer create-project laravel/laravel Laravel --prefer-dist 5.1.* #创建项目
|
||||
|
Loading…
x
Reference in New Issue
Block a user