christophwurst / nextcloud-coding-standard
Nextcloud 编码标准用于 php cs fixer
v1.3.1
2024-09-19 09:07 UTC
Requires
- php: ^7.3|^8.0
- kubawerlos/php-cs-fixer-custom-fixers: ^3.22
- php-cs-fixer/shim: ^3.17
- dev-master
- v1.3.1
- v1.3.0
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.0
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2.0
- v0.1.0
- v0.0.2
- v0.0.1
- dev-chore/release/v1.3.1
- dev-chore/release/v1.3.0
- dev-feat/concat_space_nullable_returns
- dev-feat/return-control-blank-lines
- dev-enh/break-promoted-properties-on-multiline
- dev-feat/allow-enforce-ellipsis
- dev-enhancement/blank_line_before_statement
This package is auto-updated.
Last update: 2024-09-19 09:07:53 UTC
README
Nextcloud 编码标准用于 php cs fixer。
安装
将包添加到您的开发依赖项
composer require --dev nextcloud/coding-standard
并创建一个类似于 .php-cs-fixer.dist.php
的文件
<?php declare(strict_types=1); require_once './vendor/autoload.php'; use Nextcloud\CodingStandard\Config; $config = new Config(); $config ->getFinder() ->ignoreVCSIgnored(true) ->notPath('build') ->notPath('l10n') ->notPath('src') ->notPath('vendor') ->in(__DIR__); return $config;
要运行修复程序,您首先需要 安装它。然后,您可以通过运行 php-cs-fixer fix
来应用所有自动化修复。
为了方便,您可以将其添加到 composer.json
的 scripts
部分
{ "scripts": { "cs:check": "php-cs-fixer fix --dry-run --diff", "cs:fix": "php-cs-fixer fix" } }
注意:不要忘记在构建脚本中排除 .php-cs-fixer.dist.php
和 .php-cs-fixer.cache
。
从 v0.x 升级到 v1.0
在 v1.0 中,php-cs-fixer 已从 v2 升级到 v3。您可能需要稍微调整您的应用程序
- 将
.php_cs.dist
重命名为.php-cs-fixer.dist.php
- 将
.php-cs-fixer.cache
添加到您的忽略文件中