-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSpacesLevel.php
More file actions
122 lines (113 loc) · 4.72 KB
/
Copy pathSpacesLevel.php
File metadata and controls
122 lines (113 loc) · 4.72 KB
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
113
114
115
116
117
118
119
120
121
122
<?php
declare(strict_types=1);
namespace Symplify\EasyCodingStandard\Config\Level;
use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\LanguageConstructSpacingSniff;
use PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\SuperfluousWhitespaceSniff;
use PhpCsFixer\Fixer\CastNotation\CastSpacesFixer;
use PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer;
use PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer;
use PhpCsFixer\Fixer\ClassNotation\SingleTraitInsertPerStatementFixer;
use PhpCsFixer\Fixer\FixerInterface;
use PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer;
use PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer;
use PhpCsFixer\Fixer\NamespaceNotation\NoLeadingNamespaceWhitespaceFixer;
use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;
use PhpCsFixer\Fixer\Operator\ConcatSpaceFixer;
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
use PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocSingleLineVarSpacingFixer;
use PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer;
use PhpCsFixer\Fixer\Semicolon\NoSinglelineWhitespaceBeforeSemicolonsFixer;
use PhpCsFixer\Fixer\Semicolon\SpaceAfterSemicolonFixer;
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer;
use PhpCsFixer\Fixer\Whitespace\NoSpacesAroundOffsetFixer;
use PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer;
use PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer;
use PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer;
use Symplify\CodingStandard\Fixer\Spacing\MethodChainingNewlineFixer;
use Symplify\CodingStandard\Fixer\Spacing\SpaceAfterCommaHereNowDocFixer;
use Symplify\CodingStandard\Fixer\Spacing\StandaloneLinePromotedPropertyFixer;
use Symplify\CodingStandard\Fixer\Strict\BlankLineAfterStrictTypesFixer;
/**
* Key 0 = level 0
* Key 22 = level 22
*
* Start at 0, go slowly higher, one level per PR, and improve your spacing coverage.
*
* From the safest rules to more changing ones.
*
* This list can change in time, based on community feedback,
* what rules are safer than other. The safest rules will be always in the top.
*/
final class SpacesLevel
{
/**
* @var array<class-string<Sniff|FixerInterface>>
*/
public const array RULES = [
// easy picks - pure whitespace cleanup with no formatting opinion
NoLeadingNamespaceWhitespaceFixer::class,
NoSinglelineWhitespaceBeforeSemicolonsFixer::class,
NoWhitespaceInBlankLineFixer::class,
NoSpacesAroundOffsetFixer::class,
SpaceAfterSemicolonFixer::class,
NoBlankLinesAfterClassOpeningFixer::class,
BlankLineAfterOpeningTagFixer::class,
SingleTraitInsertPerStatementFixer::class,
PhpdocSingleLineVarSpacingFixer::class,
LanguageConstructSpacingSniff::class,
// operator and type spacing
CastSpacesFixer::class,
NotOperatorWithSuccessorSpaceFixer::class,
TernaryOperatorSpacesFixer::class,
ReturnTypeDeclarationFixer::class,
TypeDeclarationSpacesFixer::class,
TypesSpacesFixer::class,
SuperfluousWhitespaceSniff::class,
// configurable, more impactful
ConcatSpaceFixer::class,
BinaryOperatorSpacesFixer::class,
// most invasive structural changes
MethodChainingIndentationFixer::class,
StandaloneLinePromotedPropertyFixer::class,
MethodArgumentSpaceFixer::class,
ClassAttributesSeparationFixer::class,
NoExtraBlankLinesFixer::class,
// newline spacing (from deprecated "symplify" set)
BlankLineAfterStrictTypesFixer::class,
SpaceAfterCommaHereNowDocFixer::class,
MethodChainingNewlineFixer::class,
];
/**
* Configurations matching the spaces set, applied when a configurable rule
* is enabled via withSpacesLevel(). Rules absent from this map use defaults.
*
* @var array<class-string<Sniff|FixerInterface>, mixed[]>
*/
public const array RULE_CONFIGURATIONS = [
ClassAttributesSeparationFixer::class => [
'elements' => [
'const' => 'one',
'property' => 'one',
'method' => 'one',
],
],
NoExtraBlankLinesFixer::class => [
'tokens' => ['extra', 'throw', 'use'],
],
ConcatSpaceFixer::class => [
'spacing' => 'one',
],
SuperfluousWhitespaceSniff::class => [
'ignoreBlankLines' => false,
],
BinaryOperatorSpacesFixer::class => [
'operators' => [
'=>' => 'single_space',
'=' => 'single_space',
],
],
];
}