Skip to content

Commit 9831d07

Browse files
committed
Move configured rules to final sets
1 parent 32a3911 commit 9831d07

File tree

3 files changed

+88
-44
lines changed

3 files changed

+88
-44
lines changed

sets/base.php

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
declare(strict_types=1);
44

55
use Hereldar\CodingStyle\Rules\ClarifyingParenthesesAroundComparisonsFixer;
6-
use Hereldar\CodingStyle\Rules\GlobalNamespaceImportFixer;
76
use Hereldar\CodingStyle\Rules\MultilineWhitespaceBeforeDoubleColonFixer;
87
use PhpCsFixer\Fixer\Basic\SingleLineEmptyBodyFixer;
98
use PhpCsFixer\Fixer\ClassNotation\SelfStaticAccessorFixer;
@@ -12,17 +11,11 @@
1211
use PhpCsFixer\Fixer\ControlStructure\SimplifiedIfReturnFixer;
1312
use PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveIssetsFixer;
1413
use PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveUnsetsFixer;
15-
use PhpCsFixer\Fixer\Operator\OperatorLinebreakFixer;
16-
use PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer;
17-
use PhpCsFixer\Fixer\Phpdoc\PhpdocNoAliasTagFixer;
1814
use PhpCsFixer\Fixer\Phpdoc\PhpdocOrderByValueFixer;
19-
use PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer;
20-
use PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer;
2115
use PhpCsFixer\Fixer\PhpUnit\PhpUnitDedicateAssertFixer;
2216
use PhpCsFixer\Fixer\PhpUnit\PhpUnitDedicateAssertInternalTypeFixer;
2317
use PhpCsFixer\Fixer\PhpUnit\PhpUnitExpectationFixer;
2418
use PhpCsFixer\Fixer\StringNotation\ExplicitStringVariableFixer;
25-
use PhpCsFixer\Fixer\StringNotation\StringImplicitBackslashesFixer;
2619
use PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer;
2720
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
2821
use Symplify\CodingStandard\Fixer\Strict\BlankLineAfterStrictTypesFixer;
@@ -58,43 +51,6 @@
5851
SimplifiedIfReturnFixer::class,
5952
SingleLineEmptyBodyFixer::class,
6053
])
61-
->withConfiguredRule(
62-
GlobalNamespaceImportFixer::class,
63-
['import_classes' => true, 'import_constants' => false, 'import_functions' => false],
64-
)
65-
->withConfiguredRule(
66-
OperatorLinebreakFixer::class,
67-
['position' => 'beginning'],
68-
)
69-
->withConfiguredRule(
70-
PhpdocAlignFixer::class,
71-
['align' => 'left'],
72-
)
73-
->withConfiguredRule(
74-
PhpdocNoAliasTagFixer::class,
75-
['replacements' => ['type' => 'var', 'link' => 'see']],
76-
)
77-
->withConfiguredRule(
78-
PhpdocSeparationFixer::class,
79-
['groups' => [
80-
['deprecated', 'link', 'see', 'since'],
81-
['author', 'copyright', 'license'],
82-
['category', 'package', 'subpackage'],
83-
['property', 'property-read', 'property-write', 'phpstan-property', 'phpstan-property-read', 'phpstan-property-write', 'psalm-property', 'psalm-property-read', 'psalm-property-write'],
84-
['pure', 'phpstan-pure', 'psalm-pure'],
85-
['param', 'phpstan-param', 'psalm-param'],
86-
['return', 'phpstan-return', 'psalm-return'],
87-
['throws', 'phpstan-throws', 'psalm-throws'],
88-
]],
89-
)
90-
->withConfiguredRule(
91-
PhpdocToCommentFixer::class,
92-
['ignored_tags' => ['var', 'phpstan-var', 'psalm-var', 'phpstan-ignore-next-line', 'psalm-suppress']],
93-
)
94-
->withConfiguredRule(
95-
StringImplicitBackslashesFixer::class,
96-
['single_quoted' => 'ignore'],
97-
)
9854
->withSpacing(
9955
indentation: ECS::INDENTATION_SPACES,
10056
lineEnding: PHP_EOL

sets/libraries.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,27 @@
33
declare(strict_types=1);
44

55
use Hereldar\CodingStyle;
6+
use Hereldar\CodingStyle\Rules\GlobalNamespaceImportFixer;
67
use PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer;
78
use PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer;
89
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;
10+
use PhpCsFixer\Fixer\Operator\OperatorLinebreakFixer;
11+
use PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer;
12+
use PhpCsFixer\Fixer\Phpdoc\PhpdocNoAliasTagFixer;
13+
use PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer;
14+
use PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer;
15+
use PhpCsFixer\Fixer\StringNotation\StringImplicitBackslashesFixer;
916
use Symplify\EasyCodingStandard\Config\ECSConfig;
1017

1118
return ECSConfig
1219
::configure()
1320
->withSets([
1421
CodingStyle::BASE,
1522
])
23+
->withConfiguredRule(
24+
GlobalNamespaceImportFixer::class,
25+
['import_classes' => true, 'import_constants' => false, 'import_functions' => false],
26+
)
1627
->withConfiguredRule(
1728
NativeConstantInvocationFixer::class,
1829
['scope' => 'namespaced', 'strict' => true],
@@ -21,6 +32,39 @@
2132
NativeFunctionInvocationFixer::class,
2233
['include' => ['@all'], 'scope' => 'namespaced', 'strict' => true],
2334
)
35+
->withConfiguredRule(
36+
OperatorLinebreakFixer::class,
37+
['position' => 'beginning'],
38+
)
39+
->withConfiguredRule(
40+
PhpdocAlignFixer::class,
41+
['align' => 'left'],
42+
)
43+
->withConfiguredRule(
44+
PhpdocNoAliasTagFixer::class,
45+
['replacements' => ['type' => 'var', 'link' => 'see']],
46+
)
47+
->withConfiguredRule(
48+
PhpdocSeparationFixer::class,
49+
['groups' => [
50+
['author', 'copyright', 'license'],
51+
['category', 'package', 'subpackage'],
52+
['property', 'property-read', 'property-write', 'phpstan-property', 'phpstan-property-read', 'phpstan-property-write', 'psalm-property', 'psalm-property-read', 'psalm-property-write'],
53+
['pure', 'phpstan-pure', 'psalm-pure'],
54+
['param', 'phpstan-param', 'psalm-param'],
55+
['return', 'psalm-return', 'phpstan-return'],
56+
['throws', 'phpstan-throws', 'psalm-throws'],
57+
['deprecated', 'link', 'see', 'since'],
58+
]],
59+
)
60+
->withConfiguredRule(
61+
PhpdocToCommentFixer::class,
62+
['ignored_tags' => ['var', 'phpstan-var', 'psalm-var', 'phpstan-ignore-next-line', 'psalm-suppress']],
63+
)
64+
->withConfiguredRule(
65+
StringImplicitBackslashesFixer::class,
66+
['single_quoted' => 'ignore'],
67+
)
2468
->withConfiguredRule(
2569
YodaStyleFixer::class,
2670
['equal' => true, 'identical' => true, 'less_and_greater' => true],

sets/projects.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,19 @@
33
declare(strict_types=1);
44

55
use Hereldar\CodingStyle;
6+
use Hereldar\CodingStyle\Rules\GlobalNamespaceImportFixer;
67
use PhpCsFixer\Fixer\ClassNotation\FinalClassFixer;
78
use PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer;
89
use PhpCsFixer\Fixer\ClassUsage\DateTimeImmutableFixer;
910
use PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer;
1011
use PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer;
1112
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;
13+
use PhpCsFixer\Fixer\Operator\OperatorLinebreakFixer;
14+
use PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer;
15+
use PhpCsFixer\Fixer\Phpdoc\PhpdocNoAliasTagFixer;
16+
use PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer;
17+
use PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer;
18+
use PhpCsFixer\Fixer\StringNotation\StringImplicitBackslashesFixer;
1219
use Symplify\EasyCodingStandard\Config\ECSConfig;
1320

1421
return ECSConfig
@@ -25,6 +32,43 @@
2532
FinalClassFixer::class,
2633
ProtectedToPrivateFixer::class,
2734
])
35+
->withConfiguredRule(
36+
GlobalNamespaceImportFixer::class,
37+
['import_classes' => true, 'import_constants' => false, 'import_functions' => false],
38+
)
39+
->withConfiguredRule(
40+
OperatorLinebreakFixer::class,
41+
['position' => 'beginning'],
42+
)
43+
->withConfiguredRule(
44+
PhpdocAlignFixer::class,
45+
['align' => 'left'],
46+
)
47+
->withConfiguredRule(
48+
PhpdocNoAliasTagFixer::class,
49+
['replacements' => ['type' => 'var', 'link' => 'see']],
50+
)
51+
->withConfiguredRule(
52+
PhpdocSeparationFixer::class,
53+
['groups' => [
54+
['author', 'copyright', 'license'],
55+
['category', 'package', 'subpackage'],
56+
['property', 'property-read', 'property-write', 'phpstan-property', 'phpstan-property-read', 'phpstan-property-write', 'psalm-property', 'psalm-property-read', 'psalm-property-write'],
57+
['pure', 'phpstan-pure', 'psalm-pure'],
58+
['param', 'phpstan-param', 'psalm-param'],
59+
['return', 'psalm-return', 'phpstan-return'],
60+
['throws', 'phpstan-throws', 'psalm-throws'],
61+
['deprecated', 'link', 'see', 'since'],
62+
]],
63+
)
64+
->withConfiguredRule(
65+
PhpdocToCommentFixer::class,
66+
['ignored_tags' => ['var', 'phpstan-var', 'psalm-var', 'phpstan-ignore-next-line', 'psalm-suppress']],
67+
)
68+
->withConfiguredRule(
69+
StringImplicitBackslashesFixer::class,
70+
['single_quoted' => 'ignore'],
71+
)
2872
->withConfiguredRule(
2973
YodaStyleFixer::class,
3074
['equal' => false, 'identical' => false, 'less_and_greater' => false],

0 commit comments

Comments
 (0)