Skip to content

Commit

Permalink
Merge pull request #7 from mobizel/use-ecsConfig
Browse files Browse the repository at this point in the history
Update easy-conding-standard usage to 10.2
  • Loading branch information
loic425 authored Jun 3, 2022
2 parents e5ca7ff + 1012369 commit 21d1525
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Installation & usage
2. Import the configuration file in your `ecs.php`:

```php
$containerConfigurator->import('vendor/mobizel/coding-standard/ecs.php');
$ecsConfig->import('vendor/mobizel/coding-standard/ecs.php');
```

Example config (ecs.php)
Expand All @@ -26,10 +26,10 @@ Example config (ecs.php)
<?php
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\Config\ECSConfig;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/mobizel/coding-standard/ecs.php');
return static function (ECSConfig $ecsConfig): void {
$ecsConfig->import('vendor/mobizel/coding-standard/ecs.php');
$header = <<<EOM
This file is part of <The Project>.
Expand All @@ -40,7 +40,7 @@ For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOM;
$services = $containerConfigurator->services();
$services = $ecsConfig->services();
$services
->set(HeaderCommentFixer::class)
->call('configure', [[
Expand Down
10 changes: 5 additions & 5 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestClassRequiresCoversFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(SetList::SYMFONY);
return static function (ECSConfig $ecsConfig): void {
$ecsConfig->import(SetList::PSR_12);

$services = $containerConfigurator->services();
$services = $ecsConfig->services();
$services->set(DeclareStrictTypesFixer::class);
$services->set(OrderedImportsFixer::class);
$services->set(NoUnusedImportsFixer::class);
Expand All @@ -33,7 +33,7 @@
$services->set(TrailingCommaInMultilineFixer::class)
->call('configure', [['elements' => ['arrays', 'arguments', 'parameters']]]);

$parameters = $containerConfigurator->parameters();
$parameters = $ecsConfig->parameters();
$parameters->set('skip', [
VisibilityRequiredFixer::class => ['*Spec.php'],
PhpUnitTestClassRequiresCoversFixer::class => ['*Test.php'],
Expand Down
2 changes: 1 addition & 1 deletion tests/Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ public function isIdentical(string $foo, string $bar): bool
public function run(): void
{
/** @var string|null $description */
$description = true ? 'This is a description' : null;
$description = true ? 'This is a' . ' description' : null;
}
}

0 comments on commit 21d1525

Please sign in to comment.