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
添加到您的忽略文件