davahome / php-cs-fixer-ruleset
此包最新版本(1.2.1)没有提供许可证信息。
php-cs-fixer 对于所有 davahome 项目的默认规则集
1.2.1
2020-09-13 16:24 UTC
README
DavaHome 的 php-cs-fixer 规则集
安装
php composer.phar require --dev davahome/php-cs-fixer-ruleset
用法
php_cs.php
<?php require_once __DIR__ . '/vendor/autoload.php'; return \DavaHome\PhpCsFixer::createFromDir(__DIR__)->getRuleSet();
php-cs-fixer.phar
php php-cs-fixer.phar fix --config=php_cs.php php php-cs-fixer.phar fix --dry-run --diff --config=php_cs.php
示例
php_cs.php
<?php use DavaHome\PhpCsFixer; use PhpCsFixer\Finder; require_once __DIR__ . '/vendor/autoload.php'; $finder = Finder::create() ->in(__DIR__) ->notPath('/^data/'); return (new PhpCsFixer($finder)) ->getRuleSet() ->setCacheFile(__DIR__ . '/data/cache/.php_cs.cache');
php_cs.php
<?php use DavaHome\PhpCsFixer; use PhpCsFixer\Finder; require_once __DIR__ . '/vendor/autoload.php'; $finder = Finder::create() ->in(__DIR__) ->notPath('/exclude/'); return (new PhpCsFixer($finder)) ->getRuleSet() ->setLineEnding("\r\n") ->setCacheFile('/tmp/.php_cs.cache') ->setIndent("\t") ->setRiskyAllowed(false) ->setUsingCache(true);
composer.json
{ "scripts": { "phpcs": [ "bash bin/php-cs-fixer.sh", "php php-cs-fixer.phar fix --config=php_cs.php" ] } }