1 Star 0 Fork 367

Wade.Yi/catchAdmin

forked from catchadmin/catchAdmin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
.php-cs-fixer.dist.php 2.33 KB
一键复制 编辑 原始数据 按行查看 历史
Joker 提交于 2022-12-05 23:01 . first commit
<?php
require_once __DIR__.DIRECTORY_SEPARATOR.'fixer'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
use PhpCsFixer\Finder;
use PhpCsFixer\Config;
$finder = Finder::create()
// 排除目录
//->exclude('packages')
//// ->notPath('./packages/test.php')
// in 配置需要规则的目录
->in([
__DIR__.DIRECTORY_SEPARATOR.'app',
__DIR__.DIRECTORY_SEPARATOR.'catch',
__DIR__.DIRECTORY_SEPARATOR.'modules',
])
// 排除 . 开头的文件
->ignoreDotFiles(true)
// vcs 文件
->ignoreVCS(true);
$config = new Config();
return $config->setRules([
'@PSR1' => true, // psr1
'@PSR2' => true, // psr2 规范
'@PSR12' => true, // psr12 规范
'binary_operator_spaces' => true, // 二元操作符号空格 $a=1 => $a = 1;
'array_syntax' => [
'syntax' => 'short', // array('1') => ['1']
],
'no_trailing_comma_in_singleline_array' => true, // -$a = array('sample', ); => $a = array('sample');
'trim_array_spaces' => true, // array( 'a', 'b' ); => array('a', 'b')
'single_trait_insert_per_statement' => false,
'standardize_not_equals' => true, // "!=" => "<>"
'magic_constant_casing' => true, // __dir__ => __DIR__
'native_function_casing' => true, // STRLEN($str); => strlen($str);
'cast_spaces' => true, // (int)$b => (int) $b
'simplified_if_return' => true, // if ($foo) { return true; } return false; => return (bool) ($foo) ;
'no_unused_imports' => true, // use \DateTime; -use \Exception; => use \DateTime;
'not_operator_with_successor_space' => true, // if (!$bar) => if (! $bar)
/**
* // function example($b) {
if ($b) {
return;
}
- return;
*/
'no_useless_return' => true,
/**
* function a() {
- $a = 1;
- return $a;
+ return 1;
*/
'return_assignment' => true,
/**
-<?php return null;
+<?php return;
*/
'simplified_null_return' => true,
/**
* $foo = [
- 'bar' => [
- 'baz' => true,
- ],
+ 'bar' => [
+ 'baz' => true,
+ ],
*/
'array_indentation' => true,
/**
* -$sample = $b [ 'a' ] [ 'b' ];
+$sample = $b['a']['b'];
*/
'no_spaces_around_offset' => true,
'concat_space' => true, // $a.$b => $a . $b
])->setFinder($finder);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/wadeyin/catchAdmin.git
git@gitee.com:wadeyin/catchAdmin.git
wadeyin
catchAdmin
catchAdmin
master

搜索帮助