|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer; |
| 6 | +use PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer; |
| 7 | +use PhpCsFixer\Fixer\Comment\HeaderCommentFixer; |
| 8 | +use PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer; |
| 9 | +use PhpCsFixer\Fixer\ControlStructure\NoSuperfluousElseifFixer; |
| 10 | +use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer; |
| 11 | +use PhpCsFixer\Fixer\Import\GlobalNamespaceImportFixer; |
| 12 | +use PhpCsFixer\Fixer\Import\OrderedImportsFixer; |
| 13 | +use PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveIssetsFixer; |
| 14 | +use PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveUnsetsFixer; |
| 15 | +use PhpCsFixer\Fixer\Phpdoc\AlignMultilineCommentFixer; |
| 16 | +use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer; |
| 17 | +use PhpCsFixer\Fixer\Phpdoc\PhpdocOrderFixer; |
| 18 | +use PhpCsFixer\Fixer\Phpdoc\PhpdocTrimConsecutiveBlankLineSeparationFixer; |
| 19 | +use PhpCsFixer\Fixer\PhpTag\LinebreakAfterOpeningTagFixer; |
| 20 | +use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer; |
| 21 | +use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestCaseStaticMethodCallsFixer; |
| 22 | +use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestClassRequiresCoversFixer; |
| 23 | +use PhpCsFixer\Fixer\ReturnNotation\SimplifiedNullReturnFixer; |
| 24 | +use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer; |
| 25 | +use PhpCsFixer\Fixer\Strict\StrictComparisonFixer; |
| 26 | +use PhpCsFixer\Fixer\Strict\StrictParamFixer; |
| 27 | +use PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer; |
| 28 | +use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer; |
| 29 | +use Symplify\CodingStandard\Fixer\Spacing\MethodChainingNewlineFixer; |
| 30 | +use Symplify\EasyCodingStandard\Config\ECSConfig; |
| 31 | +use Symplify\EasyCodingStandard\ValueObject\Set\SetList; |
| 32 | + |
| 33 | +return static function (ECSConfig $config): void { |
| 34 | + $header = ''; |
| 35 | + $config->import(SetList::PSR_12); |
| 36 | + $config->import(SetList::CLEAN_CODE); |
| 37 | + $config->import(SetList::DOCTRINE_ANNOTATIONS); |
| 38 | + $config->import(SetList::SPACES); |
| 39 | + $config->import(SetList::PHPUNIT); |
| 40 | + $config->import(SetList::SYMPLIFY); |
| 41 | + $config->import(SetList::ARRAY); |
| 42 | + $config->import(SetList::COMMON); |
| 43 | + $config->import(SetList::COMMENTS); |
| 44 | + $config->import(SetList::CONTROL_STRUCTURES); |
| 45 | + $config->import(SetList::DOCBLOCK); |
| 46 | + $config->import(SetList::NAMESPACES); |
| 47 | + $config->import(SetList::STRICT); |
| 48 | + |
| 49 | + $config->rule(StrictParamFixer::class); |
| 50 | + $config->rule(StrictComparisonFixer::class); |
| 51 | + $config->rule(ArrayIndentationFixer::class); |
| 52 | + $config->rule(OrderedImportsFixer::class); |
| 53 | + $config->rule(ProtectedToPrivateFixer::class); |
| 54 | + $config->rule(DeclareStrictTypesFixer::class); |
| 55 | + $config->rule(NativeConstantInvocationFixer::class); |
| 56 | + $config->rule(LinebreakAfterOpeningTagFixer::class); |
| 57 | + $config->rule(CombineConsecutiveIssetsFixer::class); |
| 58 | + $config->rule(CombineConsecutiveUnsetsFixer::class); |
| 59 | + $config->rule(NoSuperfluousElseifFixer::class); |
| 60 | + $config->rule(NoSuperfluousPhpdocTagsFixer::class); |
| 61 | + $config->rule(PhpdocTrimConsecutiveBlankLineSeparationFixer::class); |
| 62 | + $config->rule(PhpdocOrderFixer::class); |
| 63 | + $config->rule(SimplifiedNullReturnFixer::class); |
| 64 | + $config->rule(PhpUnitTestCaseStaticMethodCallsFixer::class); |
| 65 | + $config->ruleWithConfiguration(ArraySyntaxFixer::class, [ |
| 66 | + 'syntax' => 'short', |
| 67 | + ]); |
| 68 | + $config->ruleWithConfiguration(NativeFunctionInvocationFixer::class, [ |
| 69 | + 'include' => ['@compiler_optimized'], |
| 70 | + 'scope' => 'namespaced', |
| 71 | + 'strict' => true, |
| 72 | + ]); |
| 73 | + $config->ruleWithConfiguration(HeaderCommentFixer::class, [ |
| 74 | + 'header' => $header, |
| 75 | + ]); |
| 76 | + $config->ruleWithConfiguration(AlignMultilineCommentFixer::class, [ |
| 77 | + 'comment_type' => 'all_multiline', |
| 78 | + ]); |
| 79 | + $config->ruleWithConfiguration(PhpUnitTestAnnotationFixer::class, [ |
| 80 | + 'style' => 'annotation', |
| 81 | + ]); |
| 82 | + $config->ruleWithConfiguration(GlobalNamespaceImportFixer::class, [ |
| 83 | + 'import_classes' => true, |
| 84 | + 'import_constants' => true, |
| 85 | + 'import_functions' => true, |
| 86 | + ]); |
| 87 | + |
| 88 | + $config->skip([ |
| 89 | + PhpUnitTestClassRequiresCoversFixer::class, |
| 90 | + MethodChainingIndentationFixer::class => [__DIR__ . '/src/Resources/config'], |
| 91 | + MethodChainingNewlineFixer::class => [__DIR__ . '/src/Resources/config'], |
| 92 | + ]); |
| 93 | + |
| 94 | + $config->parallel(); |
| 95 | + $config->paths([ |
| 96 | + __DIR__ . '/../src', |
| 97 | + __DIR__ . '/../tests', |
| 98 | + __DIR__ . '/../castor.php', |
| 99 | + __DIR__ . '/ecs.php', |
| 100 | + __DIR__ . '/rector.php', |
| 101 | + ]); |
| 102 | +}; |
0 commit comments