|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +use PhpCsFixer\Fixer\Basic\SingleLineEmptyBodyFixer; |
| 6 | +use PhpCsFixer\Fixer\CastNotation\CastSpacesFixer; |
| 7 | +use PhpCsFixer\Fixer\Comment\HeaderCommentFixer; |
| 8 | +use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer; |
| 9 | +use PhpCsFixer\Fixer\Operator\OperatorLinebreakFixer; |
| 10 | +use PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer; |
| 11 | +use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer; |
| 12 | +use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer; |
| 13 | +use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer; |
| 14 | +use PhpCsFixer\Fixer\Strict\StrictComparisonFixer; |
| 15 | +use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer; |
| 16 | +use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer; |
| 17 | +use Symplify\CodingStandard\Fixer\Spacing\MethodChainingNewlineFixer; |
| 18 | +use Symplify\EasyCodingStandard\Config\ECSConfig; |
| 19 | +use Symplify\EasyCodingStandard\ValueObject\Set\SetList; |
| 20 | + |
| 21 | +return static function (ECSConfig $ecsConfig): void { |
| 22 | + $ecsConfig->paths([ |
| 23 | + __DIR__ . '/../../Build', |
| 24 | + __DIR__ . '/../../Classes', |
| 25 | + __DIR__ . '/../../Configuration', |
| 26 | + __DIR__ . '/../../ext_emconf.php', |
| 27 | + ]); |
| 28 | + |
| 29 | + $ecsConfig->sets([ |
| 30 | + SetList::PSR_12, |
| 31 | + SetList::CLEAN_CODE, |
| 32 | + SetList::SYMPLIFY, |
| 33 | + SetList::ARRAY, |
| 34 | + SetList::COMMON, |
| 35 | + SetList::COMMENTS, |
| 36 | + SetList::CONTROL_STRUCTURES, |
| 37 | + SetList::DOCBLOCK, |
| 38 | + SetList::NAMESPACES, |
| 39 | + SetList::PHPUNIT, |
| 40 | + SetList::SPACES, |
| 41 | + SetList::STRICT, |
| 42 | + ]); |
| 43 | + |
| 44 | + $ecsConfig->ruleWithConfiguration(GeneralPhpdocAnnotationRemoveFixer::class, [ |
| 45 | + 'annotations' => ['author', 'package', 'group'], |
| 46 | + ]); |
| 47 | + |
| 48 | + $ecsConfig->ruleWithConfiguration(NoSuperfluousPhpdocTagsFixer::class, [ |
| 49 | + 'allow_mixed' => true, |
| 50 | + ]); |
| 51 | + |
| 52 | + $ecsConfig->ruleWithConfiguration(CastSpacesFixer::class, [ |
| 53 | + 'space' => 'single', |
| 54 | + ]); |
| 55 | + |
| 56 | + $ecsConfig->ruleWithConfiguration(HeaderCommentFixer::class, [ |
| 57 | + 'header' => <<<EOF |
| 58 | +This file is part of the TYPO3 CMS project. |
| 59 | +
|
| 60 | +(c) Christoph Lehmann, Simon Schaufelberger |
| 61 | +
|
| 62 | +It is free software; you can redistribute it and/or modify it under |
| 63 | +the terms of the GNU General Public License, either version 2 |
| 64 | +of the License, or any later version. |
| 65 | +
|
| 66 | +For the full copyright and license information, please read the |
| 67 | +LICENSE.txt file that was distributed with this source code. |
| 68 | +
|
| 69 | +The TYPO3 project - inspiring people to share! |
| 70 | +EOF |
| 71 | + ]); |
| 72 | + |
| 73 | + // Rules that are not in a set |
| 74 | + $ecsConfig->rule(OperatorLinebreakFixer::class); |
| 75 | + $ecsConfig->rule(SingleLineEmptyBodyFixer::class); |
| 76 | + |
| 77 | + $ecsConfig->skip([ |
| 78 | + LineLengthFixer::class, |
| 79 | + DeclareStrictTypesFixer::class => [ |
| 80 | + __DIR__ . '/../../ext_emconf.php', |
| 81 | + ], |
| 82 | + NotOperatorWithSuccessorSpaceFixer::class, |
| 83 | + |
| 84 | + StrictComparisonFixer::class, |
| 85 | + |
| 86 | + /*HeaderCommentFixer::class => [ |
| 87 | + __DIR__ . '/../ecs/ecs.php', |
| 88 | + __DIR__ . '/../fractor/fractor.php', |
| 89 | + __DIR__ . '/../rector/rector.php', |
| 90 | + __DIR__ . '/../../ext_emconf.php', |
| 91 | + ],*/ |
| 92 | + HeaderCommentFixer::class, |
| 93 | + |
| 94 | + UnaryOperatorSpacesFixer::class, |
| 95 | + MethodChainingIndentationFixer::class, |
| 96 | + MethodChainingNewlineFixer::class, |
| 97 | + ]); |
| 98 | +}; |
0 commit comments