From 28ca84cef482a17b3e2b97abc3d91d33ad579d37 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 4 May 2026 10:32:02 +0200 Subject: [PATCH 1/2] remove scripts command, as out of ecs scope --- README.md | 22 ---------- src/Console/Command/ScriptsCommand.php | 59 -------------------------- 2 files changed, 81 deletions(-) delete mode 100644 src/Console/Command/ScriptsCommand.php diff --git a/README.md b/README.md index a14eec5fc4..af1ac7a555 100644 --- a/README.md +++ b/README.md @@ -173,28 +173,6 @@ Mentioned values are default ones.
-Do you use ECS across variety of project? Do you want to run them always the same way in each of those project? Let's make use of [Composer scripts](https://blog.martinhujer.cz/have-you-tried-composer-scripts/) - -This command adds 2 handy scripts to your `composer.json`: - -```bash -vendor/bin/ecs scripts -``` - -Run them always the same way - to check the code: - -```bash -composer check-cs -``` - -To apply fixes, run: - -```bash -composer fix-cs -``` - -
- ### Controlling Output Format You may want to use ECS to generate reports for third-party tooling. diff --git a/src/Console/Command/ScriptsCommand.php b/src/Console/Command/ScriptsCommand.php deleted file mode 100644 index 8760961174..0000000000 --- a/src/Console/Command/ScriptsCommand.php +++ /dev/null @@ -1,59 +0,0 @@ -setName('scripts'); - $this->setDescription('Enhance "scripts" section in composer.json with shortcuts'); - - parent::configure(); - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $composerJsonFilePath = getcwd() . DIRECTORY_SEPARATOR . 'composer.json'; - if (! file_exists($composerJsonFilePath)) { - $this->symfonyStyle->error('The "composer.json" was not found.'); - - return self::FAILURE; - } - - $composerJson = JsonFileSystem::readFilePath($composerJsonFilePath); - - if (isset($composerJson['scripts']['check-cs']) && isset($composerJson['scripts']['fix-cs'])) { - $this->symfonyStyle->warning('The scripts were already added. You can run them:'); - - $this->symfonyStyle->listing(['composer check-cs', 'composer fix-cs']); - - return self::SUCCESS; - } - - $composerJson['scripts']['check-cs'] = 'vendor/bin/ecs check --ansi'; - $composerJson['scripts']['fix-cs'] = 'vendor/bin/ecs check --fix --ansi'; - - JsonFileSystem::writeFilePath($composerJsonFilePath, $composerJson); - - $this->symfonyStyle->success('Your composer.json is now extended with 2 handy scripts:'); - $this->symfonyStyle->listing(['composer check-cs', 'composer fix-cs']); - - return self::SUCCESS; - } -} From 62c2540decfe4e70fbcb9daf17a218d932ea261d Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 4 May 2026 10:32:46 +0200 Subject: [PATCH 2/2] space --- README.md | 3 +- .../EasyCodingStandardConsoleApplication.php | 3 -- src/FileSystem/JsonFileSystem.php | 29 ------------------- 3 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 src/FileSystem/JsonFileSystem.php diff --git a/README.md b/README.md index af1ac7a555..3f177d3014 100644 --- a/README.md +++ b/README.md @@ -237,8 +237,7 @@ settings for: These settings will take precedence over similar rules configured through sets like PSR12, to avoid conflicting with other tooling using your `.editorconfig`. -Unfortunately, not all settings are currently respected, but PRs are always -welcome! +
## How to Migrate from another coding standard tool? diff --git a/src/Console/EasyCodingStandardConsoleApplication.php b/src/Console/EasyCodingStandardConsoleApplication.php index 8c4da50167..c57e27c4aa 100644 --- a/src/Console/EasyCodingStandardConsoleApplication.php +++ b/src/Console/EasyCodingStandardConsoleApplication.php @@ -16,7 +16,6 @@ use Symplify\EasyCodingStandard\Application\Version\StaticVersionResolver; use Symplify\EasyCodingStandard\Console\Command\CheckCommand; use Symplify\EasyCodingStandard\Console\Command\ListCheckersCommand; -use Symplify\EasyCodingStandard\Console\Command\ScriptsCommand; use Symplify\EasyCodingStandard\Console\Command\WorkerCommand; use Symplify\EasyCodingStandard\Console\Output\ConsoleOutputFormatter; use Symplify\EasyCodingStandard\ValueObject\Option; @@ -26,7 +25,6 @@ final class EasyCodingStandardConsoleApplication extends Application public function __construct( CheckCommand $checkCommand, WorkerCommand $workerCommand, - ScriptsCommand $scriptsCommand, ListCheckersCommand $listCheckersCommand ) { parent::__construct('EasyCodingStandard', StaticVersionResolver::PACKAGE_VERSION); @@ -36,7 +34,6 @@ public function __construct( $this->add($checkCommand); $this->add($workerCommand); - $this->add($scriptsCommand); $this->add($listCheckersCommand); $this->get('completion') diff --git a/src/FileSystem/JsonFileSystem.php b/src/FileSystem/JsonFileSystem.php deleted file mode 100644 index 9b12f93ca8..0000000000 --- a/src/FileSystem/JsonFileSystem.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ - public static function readFilePath(string $filePath): array - { - $fileContents = FileSystem::read($filePath); - return Json::decode($fileContents, Json::FORCE_ARRAY); - } - - /** - * @param array $data - */ - public static function writeFilePath(string $filePath, array $data): void - { - $jsonContents = Json::encode($data, Json::PRETTY); - FileSystem::write($filePath, $jsonContents, null); - } -}