|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +/* |
| 6 | + * This file is part of SolidWorx Toggler project. |
| 7 | + * |
| 8 | + * (c) SolidWorx <open-source@solidworx.co> |
| 9 | + * |
| 10 | + * This source file is subject to the MIT license that is bundled |
| 11 | + * with this source code in the file LICENSE. |
| 12 | + */ |
| 13 | + |
| 14 | +use PhpCsFixer\Fixer\Casing\MagicConstantCasingFixer; |
| 15 | +use PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer; |
| 16 | +use PhpCsFixer\Fixer\ClassNotation\SelfAccessorFixer; |
| 17 | +use PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer; |
| 18 | +use PhpCsFixer\Fixer\Comment\HeaderCommentFixer; |
| 19 | +use PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer; |
| 20 | +use PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer; |
| 21 | +use PhpCsFixer\Fixer\Import\OrderedImportsFixer; |
| 22 | +use PhpCsFixer\Fixer\LanguageConstruct\ExplicitIndirectVariableFixer; |
| 23 | +use PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer; |
| 24 | +use PhpCsFixer\Fixer\Operator\NewWithBracesFixer; |
| 25 | +use PhpCsFixer\Fixer\Operator\StandardizeIncrementFixer; |
| 26 | +use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer; |
| 27 | +use PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer; |
| 28 | +use PhpCsFixer\Fixer\StringNotation\ExplicitStringVariableFixer; |
| 29 | +use PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer; |
| 30 | +use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer; |
| 31 | +use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer; |
| 32 | +use Symplify\CodingStandard\Fixer\Spacing\MethodChainingNewlineFixer; |
| 33 | +use Symplify\EasyCodingStandard\Config\ECSConfig; |
| 34 | + |
| 35 | +$header = <<<'EOF' |
| 36 | +This file is part of SolidWorx Toggler project. |
| 37 | +
|
| 38 | +(c) SolidWorx <open-source@solidworx.co> |
| 39 | +
|
| 40 | +This source file is subject to the MIT license that is bundled |
| 41 | +with this source code in the file LICENSE. |
| 42 | +EOF; |
| 43 | + |
| 44 | +return ECSConfig::configure() |
| 45 | + ->withPaths([ |
| 46 | + __DIR__ . '/src', |
| 47 | + __DIR__ . '/tests', |
| 48 | + ]) |
| 49 | + ->withRootFiles() |
| 50 | + ->withPreparedSets( |
| 51 | + psr12: true, |
| 52 | + symplify: true, |
| 53 | + arrays: true, |
| 54 | + comments: true, |
| 55 | + docblocks: true, |
| 56 | + spaces: true, |
| 57 | + namespaces: true, |
| 58 | + controlStructures: true, |
| 59 | + phpunit: true, |
| 60 | + strict: true, |
| 61 | + cleanCode: true, |
| 62 | + ) |
| 63 | + ->withRules([ |
| 64 | + PhpUnitMethodCasingFixer::class, |
| 65 | + FunctionToConstantFixer::class, |
| 66 | + ExplicitStringVariableFixer::class, |
| 67 | + ExplicitIndirectVariableFixer::class, |
| 68 | + NewWithBracesFixer::class, |
| 69 | + StandardizeIncrementFixer::class, |
| 70 | + SelfAccessorFixer::class, |
| 71 | + MagicConstantCasingFixer::class, |
| 72 | + NoUselessElseFixer::class, |
| 73 | + SingleQuoteFixer::class, |
| 74 | + VoidReturnFixer::class, |
| 75 | + ]) |
| 76 | + ->withConfiguredRule(SingleClassElementPerStatementFixer::class, [ |
| 77 | + 'elements' => ['const', 'property'], |
| 78 | + ]) |
| 79 | + ->withConfiguredRule(ClassDefinitionFixer::class, [ |
| 80 | + 'single_line' => true, |
| 81 | + ]) |
| 82 | + ->withConfiguredRule(OrderedImportsFixer::class, [ |
| 83 | + 'imports_order' => ['const', 'class', 'function'], |
| 84 | + ]) |
| 85 | + ->withConfiguredRule(HeaderCommentFixer::class, [ |
| 86 | + 'comment_type' => 'comment', |
| 87 | + 'header' => trim($header), |
| 88 | + 'location' => 'after_declare_strict', |
| 89 | + 'separate' => 'both', |
| 90 | + ]) |
| 91 | + ->withConfiguredRule(GeneralPhpdocAnnotationRemoveFixer::class, [ |
| 92 | + 'annotations' => ['author', 'package', 'group', 'covers', 'category'], |
| 93 | + ]) |
| 94 | + ->withSkip( |
| 95 | + [ |
| 96 | + MethodChainingNewlineFixer::class, |
| 97 | + LineLengthFixer::class, |
| 98 | + MethodChainingIndentationFixer::class => [ |
| 99 | + __DIR__ . '/src/Symfony/DependencyInjection/Configuration.php', |
| 100 | + ], |
| 101 | + ] |
| 102 | + ) |
| 103 | +; |
0 commit comments