Skip to content

Commit 805b6ff

Browse files
committedOct 23, 2023
feat: add codely coding style rules
1 parent 3f82a01 commit 805b6ff

File tree

3 files changed

+40
-115
lines changed

3 files changed

+40
-115
lines changed
 

‎composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"psalm/plugin-phpunit": "^0.18.4",
6161
"phpstan/phpstan": "^1.10",
6262
"phpat/phpat": "^0.10.10",
63-
"phpmd/phpmd": "^2.14"
63+
"phpmd/phpmd": "^2.14",
64+
"codelytv/coding-style": "^0.9.0"
6465
},
6566
"autoload": {
6667
"psr-4": {

‎composer.lock

+36-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ecs.php

+2-113
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,9 @@
22

33
declare(strict_types=1);
44

5-
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
6-
use PhpCsFixer\Fixer\ArrayNotation\TrimArraySpacesFixer;
7-
use PhpCsFixer\Fixer\Basic\SingleLineEmptyBodyFixer;
8-
use PhpCsFixer\Fixer\Casing\ClassReferenceNameCasingFixer;
9-
use PhpCsFixer\Fixer\Casing\LowercaseStaticReferenceFixer;
10-
use PhpCsFixer\Fixer\Casing\MagicMethodCasingFixer;
11-
use PhpCsFixer\Fixer\Casing\NativeFunctionCasingFixer;
12-
use PhpCsFixer\Fixer\Casing\NativeFunctionTypeDeclarationCasingFixer;
13-
use PhpCsFixer\Fixer\CastNotation\CastSpacesFixer;
5+
use Codelytv\CodingStyle\CodelyRules;
146
use PhpCsFixer\Fixer\ClassNotation\FinalClassFixer;
15-
use PhpCsFixer\Fixer\ClassNotation\FinalPublicMethodForAbstractClassFixer;
16-
use PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer;
17-
use PhpCsFixer\Fixer\ClassNotation\NoNullPropertyInitializationFixer;
18-
use PhpCsFixer\Fixer\ClassNotation\NoUnneededFinalMethodFixer;
19-
use PhpCsFixer\Fixer\ClassNotation\OrderedTypesFixer;
20-
use PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer;
21-
use PhpCsFixer\Fixer\ClassNotation\SelfAccessorFixer;
22-
use PhpCsFixer\Fixer\ClassNotation\SelfStaticAccessorFixer;
23-
use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
24-
use PhpCsFixer\Fixer\ClassUsage\DateTimeImmutableFixer;
25-
use PhpCsFixer\Fixer\ControlStructure\NoUnneededControlParenthesesFixer;
26-
use PhpCsFixer\Fixer\ControlStructure\NoUnneededCurlyBracesFixer;
27-
use PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer;
28-
use PhpCsFixer\Fixer\ControlStructure\SimplifiedIfReturnFixer;
29-
use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer;
30-
use PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer;
31-
use PhpCsFixer\Fixer\Import\FullyQualifiedStrictTypesFixer;
32-
use PhpCsFixer\Fixer\Import\GlobalNamespaceImportFixer;
33-
use PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer;
34-
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
35-
use PhpCsFixer\Fixer\Operator\AssignNullCoalescingToCoalesceEqualFixer;
36-
use PhpCsFixer\Fixer\Operator\NoUselessConcatOperatorFixer;
37-
use PhpCsFixer\Fixer\Operator\NoUselessNullsafeOperatorFixer;
38-
use PhpCsFixer\Fixer\Operator\ObjectOperatorWithoutWhitespaceFixer;
39-
use PhpCsFixer\Fixer\Operator\TernaryToElvisOperatorFixer;
40-
use PhpCsFixer\Fixer\Operator\TernaryToNullCoalescingFixer;
41-
use PhpCsFixer\Fixer\PhpUnit\PhpUnitConstructFixer;
42-
use PhpCsFixer\Fixer\PhpUnit\PhpUnitDedicateAssertFixer;
43-
use PhpCsFixer\Fixer\PhpUnit\PhpUnitDedicateAssertInternalTypeFixer;
44-
use PhpCsFixer\Fixer\PhpUnit\PhpUnitExpectationFixer;
45-
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer;
46-
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
47-
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
48-
use PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer;
49-
use PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer;
50-
use PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer;
51-
use PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer;
52-
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
53-
use Symplify\CodingStandard\Fixer\Strict\BlankLineAfterStrictTypesFixer;
547
use Symplify\EasyCodingStandard\Config\ECSConfig;
55-
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
568

579
return function (ECSConfig $ecsConfig): void {
5810
$ecsConfig->paths([
@@ -61,70 +13,7 @@
6113
__DIR__ . '/tests',
6214
]);
6315

64-
$ecsConfig->sets([SetList::PSR_12]);
65-
66-
$ecsConfig->rules([
67-
// Imports
68-
NoUnusedImportsFixer::class,
69-
FullyQualifiedStrictTypesFixer::class,
70-
GlobalNamespaceImportFixer::class,
71-
NoLeadingImportSlashFixer::class,
72-
// Arrays
73-
TrimArraySpacesFixer::class,
74-
// Blank lines
75-
BlankLineAfterStrictTypesFixer::class,
76-
NoBlankLinesAfterClassOpeningFixer::class,
77-
// Spacing
78-
SingleLineEmptyBodyFixer::class,
79-
CastSpacesFixer::class,
80-
TypeDeclarationSpacesFixer::class,
81-
TypesSpacesFixer::class,
82-
// Casing
83-
ClassReferenceNameCasingFixer::class,
84-
LowercaseStaticReferenceFixer::class,
85-
MagicMethodCasingFixer::class,
86-
NativeFunctionCasingFixer::class,
87-
NativeFunctionTypeDeclarationCasingFixer::class,
88-
// Architecture
89-
FinalClassFixer::class,
90-
FinalPublicMethodForAbstractClassFixer::class,
91-
ProtectedToPrivateFixer::class,
92-
VisibilityRequiredFixer::class,
93-
DateTimeImmutableFixer::class,
94-
NoUselessElseFixer::class,
95-
// Operator
96-
AssignNullCoalescingToCoalesceEqualFixer::class,
97-
NoUselessConcatOperatorFixer::class,
98-
NoUselessNullsafeOperatorFixer::class,
99-
ObjectOperatorWithoutWhitespaceFixer::class,
100-
TernaryToElvisOperatorFixer::class,
101-
TernaryToNullCoalescingFixer::class,
102-
// Testing
103-
PhpUnitConstructFixer::class,
104-
PhpUnitDedicateAssertFixer::class,
105-
PhpUnitDedicateAssertInternalTypeFixer::class,
106-
PhpUnitExpectationFixer::class,
107-
// Other
108-
LineLengthFixer::class,
109-
NoNullPropertyInitializationFixer::class,
110-
NoUnneededFinalMethodFixer::class,
111-
SelfAccessorFixer::class,
112-
SelfStaticAccessorFixer::class,
113-
NoUnneededControlParenthesesFixer::class,
114-
NoUnneededCurlyBracesFixer::class,
115-
SimplifiedIfReturnFixer::class,
116-
TrailingCommaInMultilineFixer::class,
117-
DeclareStrictTypesFixer::class,
118-
StrictComparisonFixer::class,
119-
SingleQuoteFixer::class,
120-
StatementIndentationFixer::class,
121-
]);
122-
123-
$ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, ['syntax' => 'short']);
124-
$ecsConfig->ruleWithConfiguration(LineLengthFixer::class, [LineLengthFixer::LINE_LENGTH => 120]);
125-
$ecsConfig->ruleWithConfiguration(YodaStyleFixer::class, ['equal' => false, 'identical' => false, 'less_and_greater' => false]);
126-
$ecsConfig->ruleWithConfiguration(PhpUnitMethodCasingFixer::class, ['case' => PhpUnitMethodCasingFixer::SNAKE_CASE]);
127-
$ecsConfig->ruleWithConfiguration(OrderedTypesFixer::class, ['null_adjustment' => 'always_last']);
16+
$ecsConfig->sets([CodelyRules::CODING_STYLE]);
12817

12918
$ecsConfig->skip([
13019
FinalClassFixer::class => [

0 commit comments

Comments
 (0)
Please sign in to comment.