symplify/easy-coding-standard
Easy Coding Standard (ECS) makes PHP coding standards effortless on PHP 7.2–8.5. Fast parallel runs, supports PHP_CodeSniffer and PHP-CS-Fixer, uses prepared rule sets, generates ecs.php config on first run, and can check and auto-fix code with --fix.
Full Changelog: https://github.com/easy-coding-standard/easy-coding-standard/compare/12.6.2...13.0.0
Full Changelog: https://github.com/easy-coding-standard/easy-coding-standard/compare/12.6.1...12.6.2
Full Changelog: https://github.com/easy-coding-standard/easy-coding-standard/compare/12.5.24...12.6.0
Full Changelog: https://github.com/easy-coding-standard/easy-coding-standard/compare/12.5.21...12.5.23
Full Changelog: https://github.com/easy-coding-standard/easy-coding-standard/compare/12.5.18...12.5.20
test Script by @Kenneth-Sills in https://github.com/easy-coding-standard/easy-coding-standard/pull/227Full Changelog: https://github.com/easy-coding-standard/easy-coding-standard/compare/12.5.6...12.5.8
Full Changelog: https://github.com/easy-coding-standard/easy-coding-standard/compare/12.5.4...12.5.5
Full Changelog: https://github.com/easy-coding-standard/easy-coding-standard/compare/12.2.0...12.2.1
--no-diffs CLI Option (#195), thanks @staabmEasyCodingStandardStyle->isDebug() (#194), thanks @staabmecs.phpRunning 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 :+1:
Read more in https://tomasvotruba.com/blog/new-in-ecs-simpler-config/
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);
};
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]);
};
Do you have multi-core CPUs? ECS can run in X parallel threads, where X is number of your threads. E.g. with laptop with AMD Ryzen 4750U it is 16.
That means 1600 % faster run with same amount of analysed files. Did you code base took 16 minutes to fix? Now it's 1 minute.
This feature is:
Try it:
// ecs.php
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PARALLEL, true);
};
And that's it :wink:
The parallel run is heavily based on @phpstan parallel run - thanks to Ondřej Mirtes for inspiration :pray:
Since 9.3.3, the package is downgraded to PHP 7.1 and scoped. The former package https://github.com/symplify/easy-coding-standard-prefixed is deprecated and replaced by symplify/easy-coding-standard should be used instead.
Read more in standalone post https://tomasvotruba.com/blog/introducing-ecs-prefixed-and-downgraded-to-php-71
How can I help you explore Laravel packages today?