加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
.php-cs-fixer.php 4.82 KB
一键复制 编辑 原始数据 按行查看 历史
zxin 提交于 2023-06-10 12:29 . 更新 php-cs-fixer 版本 (#536)
<?php
declare(strict_types=1);
if (!file_exists(__DIR__ . '/src'))
{
exit(0);
}
return (new PhpCsFixer\Config())
->setRules([
'@PHP74Migration' => true,
'@PHP74Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'@DoctrineAnnotation' => true,
'php_unit_dedicate_assert' => ['target' => '5.6'],
'array_syntax' => ['syntax' => 'short'],
'array_indentation' => true,
'binary_operator_spaces' => [
'operators' => [
'=>' => 'align_single_space',
],
],
'concat_space' => [
'spacing' => 'one',
],
'fopen_flags' => false,
'protected_to_private' => false,
'native_function_invocation' => true,
'native_constant_invocation' => true,
'combine_nested_dirname' => true,
'single_quote' => true,
'single_space_around_construct' => [
'constructs_followed_by_a_single_space' => [
'abstract',
'as',
'attribute',
'break',
'case',
'catch',
'class',
'clone',
'comment',
'const',
'const_import',
'continue',
'do',
'echo',
'else',
'elseif',
'enum',
'extends',
'final',
'finally',
'for',
'foreach',
'function',
'function_import',
'global',
'goto',
'if',
'implements',
'include',
'include_once',
'instanceof',
'insteadof',
'interface',
'match',
'named_argument',
// 'namespace', // 兼容性移除
'new',
'open_tag_with_echo',
'php_doc',
'php_open',
'print',
'private',
'protected',
'public',
'readonly',
'require',
'require_once',
'return',
'static',
'switch',
'throw',
'trait',
'try',
'type_colon',
'use',
'use_lambda',
'use_trait',
'var',
'while',
'yield',
'yield_from',
],
],
'control_structure_continuation_position' => [
'position' => 'next_line',
],
'single_line_comment_style' => false,
'phpdoc_to_comment' => false,
'declare_strict_types' => true,
'heredoc_indentation' => [
'indentation' => 'same_as_start',
],
'no_trailing_whitespace_in_string' => false,
'static_lambda' => true,
'modernize_strpos' => true,
'regular_callable_call' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'explicit_indirect_variable' => true,
'no_useless_return' => true,
'return_assignment' => true,
'explicit_string_variable' => true,
'heredoc_to_nowdoc' => true,
'void_return' => false, // BUG:https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/6690
// Symfony 冲突
'curly_braces_position' => [
'control_structures_opening_brace' => 'next_line_unless_newline_at_signature_end',
],
'nullable_type_declaration_for_default_null_value' => false,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
'allow_unused_params' => false,
'remove_inheritdoc' => false,
],
'no_null_property_initialization' => false,
// 当支持 php>=8.0 后改配置可以移除
'get_class_to_class_keyword' => false,
])
->setRiskyAllowed(true)
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
->notName('*.macro.php')
->notPath('src/Components/swoole/src/Util/Coroutine.typed.php') // 兼容 Swoole 5.0,需要 PHP >= 8.0
->notPath('src/Components/hprose/src/Imi-Server-Hprose/Server.php') // bug: https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/6534
->notPath('src/Components/grpc/example/grpc')
)
;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化