diff --git a/.github/workflows/php_analysis.yml b/.github/workflows/php_analysis.yml index 22db855918..0d5914ec07 100644 --- a/.github/workflows/php_analysis.yml +++ b/.github/workflows/php_analysis.yml @@ -48,4 +48,4 @@ jobs: - name: PhpStan if: (${{ success() }} || ${{ steps.psalm.outcome }} == 'failure') - run: vendor/bin/phpstan analyse \ No newline at end of file + run: vendor/bin/phpstan analyse diff --git a/ecs.php b/ecs.php index a3e85074ba..99e9dd166f 100644 --- a/ecs.php +++ b/ecs.php @@ -6,13 +6,13 @@ declare(strict_types=1); use PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays\DisallowLongArraySyntaxSniff; use PhpCsFixer\Fixer\ArrayNotation\TrailingCommaInMultilineArrayFixer; -use PhpCsFixer\Fixer\Operator\IncrementStyleFixer; +use PhpCsFixer\Fixer\Import\GlobalNamespaceImportFixer; //use SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff; +use PhpCsFixer\Fixer\Operator\IncrementStyleFixer; use SlevomatCodingStandard\Sniffs\TypeHints\PropertyTypeHintSniff; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symplify\EasyCodingStandard\ValueObject\Option; use Symplify\EasyCodingStandard\ValueObject\Set\SetList; -use PhpCsFixer\Fixer\Import\GlobalNamespaceImportFixer; // Run php vendor/bin/ecs check src // See documentation: https://github.com/symplify/easy-coding-standard @@ -48,6 +48,32 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(\PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer::class); $services->set(\PhpCsFixer\Fixer\ReturnNotation\NoUselessReturnFixer::class); $services->set(\PhpCsFixer\Fixer\CastNotation\ModernizeTypesCastingFixer::class); + $services->set(\PhpCsFixer\Fixer\Casing\ConstantCaseFixer::class); + $services->set(\PhpCsFixer\Fixer\Phpdoc\PhpdocOrderFixer::class); + $services->set(\PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer::class); + + + $services->set(\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer::class) + ->call( + 'configure', + [ + [ + 'spacing' => 'none', + ], + ] + ); + + $services->set(GlobalNamespaceImportFixer::class) + ->call( + 'configure', + [ + [ + 'import_classes' => true, + 'import_constants' => true, + 'import_functions' => false, + ], + ] + ); $parameters->set( Option::PATHS, @@ -59,41 +85,20 @@ return static function (ContainerConfigurator $containerConfigurator): void { $parameters->set( Option::SKIP, [ + __DIR__.'/src/CoreBundle/Hook/*', __DIR__.'/src/CoreBundle/Component/HTMLPurifier/Filter/AllowIframes.php', + __DIR__.'/src/CoreBundle/Traits/*', __DIR__.'/src/CoreBundle/Menu/*', __DIR__.'/src/CourseBundle/Component/*', - __DIR__.'/src/CoreBundle/Hook/*', - __DIR__.'/src/CoreBundle/Traits/*', //__DIR__.'/src/LtiBundle/*', IncrementStyleFixer::class => 'post', PropertyTypeHintSniff::class.'.'.PropertyTypeHintSniff::CODE_MISSING_TRAVERSABLE_TYPE_HINT_SPECIFICATION, \PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationArrayAssignmentFixer::class, \PhpCsFixer\Fixer\Comment\SingleLineCommentStyleFixer::class, - \PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer::class + \PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer::class, //UnusedVariableSniff::class . '.ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach' => true, //UnusedVariableSniff::class => 'ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach', ] ); - $services->set(\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer::class) - ->call( - 'configure', - [ - [ - 'spacing' => 'none', - ], - ] - ); - - $services->set(GlobalNamespaceImportFixer::class) - ->call( - 'configure', - [ - [ - 'import_classes' => true, - 'import_constants' => true, - 'import_functions' => false, - ], - ] - ); };