1+ <?php
2+
3+ use PhpCsFixer \Fixer ;
4+ use Symplify \EasyCodingStandard \Config \ECSConfig ;
5+ use Symplify \EasyCodingStandard \ValueObject \Set \SetList ;
6+
7+ $ header = <<<HEADER
8+ This source file is available under two different licenses:
9+ - GNU General Public License version 3 (GPLv3)
10+ - DACHCOM Commercial License (DCL)
11+ Full copyright and license information is available in
12+ LICENSE.md which is distributed with this source code.
13+
14+ @copyright Copyright (c) DACHCOM.DIGITAL AG (https://www.dachcom-digital.com)
15+ @license GPLv3 and DCL
16+ HEADER ;
17+
18+ return ECSConfig::configure ()
19+ ->withSets ([SetList::CLEAN_CODE , SetList::PSR_12 ])
20+ ->withConfiguredRule (Fixer \Comment \HeaderCommentFixer::class, [
21+ 'header ' => $ header ,
22+ 'comment_type ' => 'comment '
23+ ])
24+ ->withConfiguredRule (Fixer \Basic \BracesFixer::class, [
25+ 'allow_single_line_closure ' => true ,
26+ ])
27+ ->withConfiguredRule (Fixer \Operator \ConcatSpaceFixer::class, [
28+ 'spacing ' => 'one ' ,
29+ ])
30+ ->withConfiguredRule (Fixer \Phpdoc \PhpdocAlignFixer::class, [
31+ 'tags ' => ['method ' , 'param ' , 'property ' , 'return ' , 'throws ' , 'type ' , 'var ' ],
32+ ])
33+ ->withConfiguredRule (Fixer \Operator \BinaryOperatorSpacesFixer::class, [
34+ 'operators ' => [
35+ '= ' => 'single_space ' ,
36+ '=> ' => 'align ' ,
37+ ]
38+ ])
39+ ->withConfiguredRule (Fixer \Operator \IncrementStyleFixer::class, [
40+ 'style ' => 'post ' ,
41+ ])
42+ ->withConfiguredRule (Fixer \ClassNotation \ClassAttributesSeparationFixer::class, [
43+ 'elements ' => [
44+ 'const ' => 'none ' ,
45+ 'method ' => 'one ' ,
46+ 'property ' => 'none ' ,
47+ 'trait_import ' => 'none '
48+ ],
49+ ])
50+ ->withConfiguredRule (Fixer \ClassNotation \ClassDefinitionFixer::class, [
51+ 'single_line ' => true ,
52+ ])
53+ ->withConfiguredRule (Fixer \Comment \SingleLineCommentStyleFixer::class, [
54+ 'comment_types ' => ['hash ' ],
55+ ])
56+ ->withConfiguredRule (Fixer \Alias \NoMixedEchoPrintFixer::class, [
57+ 'use ' => 'echo ' ,
58+ ])
59+ ->withConfiguredRule (Fixer \Basic \NoTrailingCommaInSinglelineFixer::class, [
60+ 'elements ' => ['array_destructuring ' ]
61+ ])
62+ ->withConfiguredRule (Fixer \NamespaceNotation \BlankLinesBeforeNamespaceFixer::class, [
63+ 'min_line_breaks ' => 2 ,
64+ 'max_line_breaks ' => 2
65+ ])
66+ ->withConfiguredRule (Fixer \Whitespace \TypeDeclarationSpacesFixer::class, [
67+ 'elements ' => ['function ' ]
68+ ])
69+ ->withConfiguredRule (Fixer \Whitespace \NoExtraBlankLinesFixer::class, [
70+ 'tokens ' => ['curly_brace_block ' , 'extra ' , 'parenthesis_brace_block ' , 'square_brace_block ' , 'throw ' , 'use ' ],
71+ ])
72+ ->withRules ([
73+ Fixer \PhpTag \BlankLineAfterOpeningTagFixer::class,
74+ Fixer \Operator \NewWithParenthesesFixer::class,
75+ Fixer \Operator \UnaryOperatorSpacesFixer::class,
76+ Fixer \Operator \ObjectOperatorWithoutWhitespaceFixer::class,
77+ Fixer \Operator \StandardizeNotEqualsFixer::class,
78+ Fixer \Operator \TernaryOperatorSpacesFixer::class,
79+ Fixer \Operator \StandardizeIncrementFixer::class,
80+ Fixer \Whitespace \BlankLineBeforeStatementFixer::class,
81+ Fixer \Whitespace \ArrayIndentationFixer::class,
82+ Fixer \Whitespace \NoSpacesAroundOffsetFixer::class,
83+ Fixer \Whitespace \NoWhitespaceInBlankLineFixer::class,
84+ Fixer \CastNotation \CastSpacesFixer::class,
85+ Fixer \CastNotation \LowercaseCastFixer::class,
86+ Fixer \CastNotation \NoShortBoolCastFixer::class,
87+ Fixer \CastNotation \ShortScalarCastFixer::class,
88+ Fixer \LanguageConstruct \DeclareEqualNormalizeFixer::class,
89+ Fixer \ControlStructure \IncludeFixer::class,
90+ Fixer \ControlStructure \NoUnneededControlParenthesesFixer::class,
91+ Fixer \Casing \NativeFunctionCasingFixer::class,
92+ Fixer \Casing \MagicConstantCasingFixer::class,
93+ Fixer \Comment \NoEmptyCommentFixer::class,
94+ Fixer \NamespaceNotation \NoLeadingNamespaceWhitespaceFixer::class,
95+ Fixer \Semicolon \NoEmptyStatementFixer::class,
96+ Fixer \Semicolon \NoSinglelineWhitespaceBeforeSemicolonsFixer::class,
97+ Fixer \Semicolon \SpaceAfterSemicolonFixer::class,
98+ Fixer \Semicolon \SemicolonAfterInstructionFixer::class,
99+ Fixer \ArrayNotation \NoWhitespaceBeforeCommaInArrayFixer::class,
100+ Fixer \ArrayNotation \NormalizeIndexBraceFixer::class,
101+ Fixer \ArrayNotation \NoMultilineWhitespaceAroundDoubleArrowFixer::class,
102+ Fixer \ArrayNotation \TrimArraySpacesFixer::class,
103+ Fixer \ArrayNotation \WhitespaceAfterCommaInArrayFixer::class,
104+ Fixer \Phpdoc \NoBlankLinesAfterPhpdocFixer::class,
105+ Fixer \Phpdoc \PhpdocAnnotationWithoutDotFixer::class,
106+ Fixer \Phpdoc \PhpdocIndentFixer::class,
107+ Fixer \Phpdoc \PhpdocInlineTagNormalizerFixer::class,
108+ Fixer \Phpdoc \PhpdocNoAccessFixer::class,
109+ Fixer \Phpdoc \PhpdocNoEmptyReturnFixer::class,
110+ Fixer \Phpdoc \PhpdocNoPackageFixer::class,
111+ Fixer \Phpdoc \PhpdocNoUselessInheritdocFixer::class,
112+ Fixer \Phpdoc \PhpdocReturnSelfReferenceFixer::class,
113+ Fixer \Phpdoc \PhpdocScalarFixer::class,
114+ Fixer \Phpdoc \PhpdocSingleLineVarSpacingFixer::class,
115+ Fixer \Phpdoc \PhpdocSummaryFixer::class,
116+ Fixer \Phpdoc \PhpdocToCommentFixer::class,
117+ Fixer \Phpdoc \PhpdocTrimFixer::class,
118+ Fixer \Phpdoc \PhpdocTypesFixer::class,
119+ Fixer \Phpdoc \NoEmptyPhpdocFixer::class,
120+ Fixer \Phpdoc \PhpdocSeparationFixer::class,
121+ Fixer \Phpdoc \PhpdocVarWithoutNameFixer::class,
122+ Fixer \Phpdoc \PhpdocNoAliasTagFixer::class,
123+ Fixer \FunctionNotation \ReturnTypeDeclarationFixer::class,
124+ Fixer \FunctionNotation \MethodArgumentSpaceFixer::class,
125+ Fixer \StringNotation \SingleQuoteFixer::class,
126+ Fixer \Import \NoUnusedImportsFixer::class,
127+ Fixer \Import \NoLeadingImportSlashFixer::class,
128+ Fixer \PhpUnit \PhpUnitFqcnAnnotationFixer::class,
129+ Fixer \ClassNotation \NoBlankLinesAfterClassOpeningFixer::class,
130+ Fixer \ClassNotation \SelfAccessorFixer::class,
131+ Fixer \ClassNotation \SingleClassElementPerStatementFixer::class,
132+ Fixer \ClassNotation \NoUnneededFinalMethodFixer::class
133+ ]);
0 commit comments