-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php-cs-fixer.dist.php
112 lines (108 loc) · 3.2 KB
/
.php-cs-fixer.dist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
declare(strict_types=1);
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixerCustomFixers\Fixers as CustomFixers;
use PhpCsFixerCustomFixers\Fixer\ConstructorEmptyBracesFixer;
use PhpCsFixerCustomFixers\Fixer\MultilinePromotedPropertiesFixer;
$finder = Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->name(['*.php', '*.phpt']);
return (new Config())
->registerCustomFixers(new CustomFixers())
->setUsingCache(false)
->setIndent(" ")
->setRules([
'@PSR2' => true,
'array_syntax' => [
'syntax' => 'short'
],
'trailing_comma_in_multiline' => [
'elements' => [
'arguments',
'arrays',
'match',
'parameters',
],
],
'constant_case' => [
'case' => 'lower',
],
'declare_strict_types' => true,
'phpdoc_align' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => [
'statements' => [
'break',
'continue',
'declare',
'return'
],
],
'blank_line_after_namespace' => true,
'blank_lines_before_namespace' => [
'max_line_breaks' => 2,
'min_line_breaks' => 2,
],
'return_type_declaration' => [
'space_before' => 'none',
],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => [
'class',
'function',
'const'
],
],
'no_unused_imports' => true,
'single_line_after_imports' => true,
'no_leading_import_slash' => true,
'global_namespace_import' => [
'import_constants' => true,
'import_functions' => true,
'import_classes' => true,
],
'fully_qualified_strict_types' => true,
'concat_space' => [
'spacing' => 'one',
],
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => false,
'remove_inheritdoc' => true,
'allow_unused_params' => false,
],
'no_empty_phpdoc' => true,
'no_blank_lines_after_phpdoc' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_trim' => true,
'no_extra_blank_lines' => [
'tokens' => [
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'throw',
'use',
],
],
'single_trait_insert_per_statement' => true,
'single_class_element_per_statement' => [
'elements' => [
'const',
'property',
]
],
'type_declaration_spaces' => [
'elements' => [
'function',
'property',
]
],
ConstructorEmptyBracesFixer::name() => true,
MultilinePromotedPropertiesFixer::name() => true,
])
->setRiskyAllowed(true)
->setFinder($finder);