github ecsphp/ecs 10.2.4
Released ECS 10.2.4 with native ECSConfig

latest releases: 13.2.3, 13.2.2, 13.2.1...
4 years ago

Make use of native ECSConfig in ecs.php

Running ECS on Symfony project can create conflict with native ContainerConfigurator. To avoid that, we introduce a new config, that is fully scoped and isolated within ECS.

Another big advantage is new configuration methods with validation and autocomplete right in your ide 👍


Read more in https://tomasvotruba.com/blog/new-in-ecs-simpler-config/

Before 💀

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;

// ups, possible conflict with ContainerConfigurator
return static function (ContainerConfigurator $containerConfigurator): void {
    $parameters = $containerConfigurator->parameters();

    // too verbose params, constants and possible typo in param value
    $parameters->set(Option::PATHS, [[ // ups, "[[" typo
        __DIR__ . '/src/',
    ]]);

    $services = $containerConfigurator->services();
    $services->set(ArraySyntaxFixer::class);
};

Now 🎉

use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ECSConfig $ecsConfig): void {
    $ecsConfig->paths([
        __DIR__ . '/src',
    ]);

    $ecsConfig->rule(ArraySyntaxFixer::class);

    $ecsConfig->sets([SetList::PSR_12]);
};

Don't miss a new ecs release

NewReleases is sending notifications on new releases.