mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 10:17:39 +08:00
e6323b048e
Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
118 lines
3.4 KiB
PHP
118 lines
3.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/**
|
|
* This file is part of Hyperf.
|
|
*
|
|
* @link https://www.hyperf.io
|
|
* @document https://hyperf.wiki
|
|
* @contact group@hyperf.io
|
|
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
|
*/
|
|
use PhpCsFixer\Config;
|
|
use PhpCsFixer\Finder;
|
|
use PhpCsFixer\Runner\Parallel\ParallelConfig;
|
|
|
|
$header = <<<'EOF'
|
|
This file is part of Hyperf.
|
|
|
|
@link https://www.hyperf.io
|
|
@document https://hyperf.wiki
|
|
@contact group@hyperf.io
|
|
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
|
EOF;
|
|
|
|
$maxProcesses = function_exists('swoole_cpu_num') ? swoole_cpu_num() : 4;
|
|
|
|
return (new Config())
|
|
->setParallelConfig(new ParallelConfig($maxProcesses, 20))
|
|
->setRiskyAllowed(true)
|
|
->setRules([
|
|
'@PSR2' => true,
|
|
'@Symfony' => true,
|
|
'@DoctrineAnnotation' => true,
|
|
'@PhpCsFixer' => true,
|
|
'header_comment' => [
|
|
'comment_type' => 'PHPDoc',
|
|
'header' => $header,
|
|
'separate' => 'none',
|
|
'location' => 'after_declare_strict',
|
|
],
|
|
'array_syntax' => [
|
|
'syntax' => 'short',
|
|
],
|
|
'list_syntax' => [
|
|
'syntax' => 'short',
|
|
],
|
|
'concat_space' => [
|
|
'spacing' => 'one',
|
|
],
|
|
'blank_line_before_statement' => [
|
|
'statements' => [
|
|
'declare',
|
|
],
|
|
],
|
|
'general_phpdoc_annotation_remove' => [
|
|
'annotations' => [
|
|
'author',
|
|
],
|
|
],
|
|
'ordered_imports' => [
|
|
'imports_order' => [
|
|
'class', 'function', 'const',
|
|
],
|
|
'sort_algorithm' => 'alpha',
|
|
],
|
|
'single_line_comment_style' => [
|
|
'comment_types' => [
|
|
],
|
|
],
|
|
'yoda_style' => [
|
|
'always_move_variable' => false,
|
|
'equal' => false,
|
|
'identical' => false,
|
|
],
|
|
'phpdoc_align' => [
|
|
'align' => 'left',
|
|
],
|
|
'multiline_whitespace_before_semicolons' => [
|
|
'strategy' => 'no_multi_line',
|
|
],
|
|
'constant_case' => [
|
|
'case' => 'lower',
|
|
],
|
|
'global_namespace_import' => [
|
|
'import_classes' => true,
|
|
'import_constants' => true,
|
|
'import_functions' => true,
|
|
],
|
|
'class_attributes_separation' => true,
|
|
'combine_consecutive_unsets' => true,
|
|
'declare_strict_types' => true,
|
|
'linebreak_after_opening_tag' => true,
|
|
'lowercase_static_reference' => true,
|
|
'no_useless_else' => true,
|
|
'no_unused_imports' => true,
|
|
'not_operator_with_successor_space' => true,
|
|
'not_operator_with_space' => false,
|
|
'ordered_class_elements' => true,
|
|
'php_unit_strict' => false,
|
|
'phpdoc_separation' => false,
|
|
'single_quote' => true,
|
|
'standardize_not_equals' => true,
|
|
'multiline_comment_opening_closing' => true,
|
|
// Since PHP 8.3, default null values can be declared as nullable.
|
|
'nullable_type_declaration_for_default_null_value' => true,
|
|
'single_line_empty_body' => false,
|
|
])
|
|
->setFinder(
|
|
Finder::create()
|
|
->exclude('bin')
|
|
->exclude('public')
|
|
->exclude('runtime')
|
|
->exclude('vendor')
|
|
->exclude('src/nacos/src/Protobuf/GPBMetadata')
|
|
->in(__DIR__)
|
|
)
|
|
->setUsingCache(false);
|