change ecs-after-rector.yaml to ecs-after-rector.php

This commit is contained in:
TomasVotruba 2020-07-16 17:51:53 +02:00
parent e90047c9cc
commit 190e54c57f
3 changed files with 32 additions and 22 deletions

View File

@ -75,7 +75,7 @@ It supports all versions of PHP from 5.2 and many open-source projects:
Rector uses [nikic/php-parser](https://github.com/nikic/PHP-Parser/), that build on technology called *abstract syntax tree*) technology* (AST). AST doesn't care about spaces and produces mall-formatted code. That's why your project needs to have coding standard tool and set of rules, so it can make refactored nice and shiny again.
Don't have any coding standard tool? Add [EasyCodingStandard](https://github.com/Symplify/EasyCodingStandard) and use prepared [`ecs-after-rector.yaml`](/ecs-after-rector.yaml) set.
Don't have any coding standard tool? Add [EasyCodingStandard](https://github.com/Symplify/EasyCodingStandard) and use prepared [`ecs-after-rector.php`](/ecs-after-rector.php) set.
## Install

29
ecs-after-rector.php Normal file
View File

@ -0,0 +1,29 @@
<?php declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer;
use PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer;
use PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
use PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(NoUnusedImportsFixer::class);
$services->set(OrderedImportsFixer::class);
$services->set(NoLeadingImportSlashFixer::class);
$services->set(NoTrailingWhitespaceInCommentFixer::class);
$services->set(NoEmptyPhpdocFixer::class);
$services->set(ClassAttributesSeparationFixer::class);
$services->set(DeclareStrictTypesFixer::class);
};

View File

@ -1,21 +1,2 @@
services:
# remove unused "use" statements
PhpCsFixer\Fixer\Import\NoUnusedImportsFixer: null
# order use statements A-Z
PhpCsFixer\Fixer\Import\OrderedImportsFixer: null
# remove leading slash ("\") at imports
PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer: null
# remove extra spaces from DocBlocks
PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer: null
# clean empty doc blocks, e.g. after annotation removal
PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer: null
# add spaces between class elements
PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer: null
# add declare strict types to start of the file
PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer: null
imports:
- { resource: 'ecs-after-rector.php' }