From bd460371978e76ac23a581c1e831f7dff458c8ef Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Tue, 4 Jun 2024 17:39:52 +0200 Subject: [PATCH] Bump and run required PHP-CS-Fixer --- CHANGELOG.md | 6 ++++++ _init/library/vendor-bin/cs-fixer/composer.json | 2 +- _init/symfony/vendor-bin/cs-fixer/composer.json | 2 +- src/Command/InitializeCommand.php | 1 + src/Initializer/InitializeHelper.php | 17 +++++++---------- vendor-bin/cs-fixer/composer.json | 2 +- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04009c5..e9c450b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +1.3.2 +===== + +* (bug) Remove breaking rule. + + 1.3.1 ===== diff --git a/_init/library/vendor-bin/cs-fixer/composer.json b/_init/library/vendor-bin/cs-fixer/composer.json index 244bb2a..ceadfce 100644 --- a/_init/library/vendor-bin/cs-fixer/composer.json +++ b/_init/library/vendor-bin/cs-fixer/composer.json @@ -1,6 +1,6 @@ { "require-dev": { - "21torr/php-cs-fixer": "^1.1", + "21torr/php-cs-fixer": "^1.1.1", "roave/security-advisories": "dev-latest" } } diff --git a/_init/symfony/vendor-bin/cs-fixer/composer.json b/_init/symfony/vendor-bin/cs-fixer/composer.json index 244bb2a..ceadfce 100644 --- a/_init/symfony/vendor-bin/cs-fixer/composer.json +++ b/_init/symfony/vendor-bin/cs-fixer/composer.json @@ -1,6 +1,6 @@ { "require-dev": { - "21torr/php-cs-fixer": "^1.1", + "21torr/php-cs-fixer": "^1.1.1", "roave/security-advisories": "dev-latest" } } diff --git a/src/Command/InitializeCommand.php b/src/Command/InitializeCommand.php index ba09a79..4c1b326 100644 --- a/src/Command/InitializeCommand.php +++ b/src/Command/InitializeCommand.php @@ -84,6 +84,7 @@ protected function execute (InputInterface $input, OutputInterface $output) : in catch (\Throwable $exception) { $io->error("Running janus failed: {$exception->getMessage()}"); + return 2; } } diff --git a/src/Initializer/InitializeHelper.php b/src/Initializer/InitializeHelper.php index 429af35..ea8f1ff 100644 --- a/src/Initializer/InitializeHelper.php +++ b/src/Initializer/InitializeHelper.php @@ -18,7 +18,7 @@ public function __construct ( private TorrStyle $io, ) { - $this->cwd = (string) \getcwd(); + $this->cwd = (string) getcwd(); } /** @@ -36,7 +36,6 @@ public function copyFilesIntoProject (string $directory) : void ]); } - /** * Add the given config to the projects composer.json * @@ -60,8 +59,8 @@ public function addToProjectComposerJson (array $config) : void * If there are multiple lines matching, all will be replaced. * If there are no lines matching, the call will just be appended. * - * @param string $key The scripts key to update. - * @param array $scripts The scripts to replace. + * @param string $key the scripts key to update + * @param array $scripts the scripts to replace */ public function updateProjectComposerJsonScripts (string $key, array $scripts) : void { @@ -107,7 +106,7 @@ private function writeProjectComposerJson (array $config) : void file_put_contents( $filePath, - \json_encode( + json_encode( $config, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_THROW_ON_ERROR, ), @@ -121,16 +120,16 @@ private function readProjectComposerJson () : array { $filePath = "{$this->cwd}/composer.json"; - $result = \json_decode( - (string) \file_get_contents($filePath), + $result = json_decode( + (string) file_get_contents($filePath), true, flags: \JSON_THROW_ON_ERROR, ); \assert(\is_array($result)); + return $result; } - /** * Runs a composer command in the project * @@ -151,7 +150,6 @@ public function runComposerInProject (array $cmd) : void $this->runProcessInProject($cmd); } - /** * Runs the given command in the project directory * @@ -180,5 +178,4 @@ public function runProcessInProject (array $cmd) : void ); } } - } diff --git a/vendor-bin/cs-fixer/composer.json b/vendor-bin/cs-fixer/composer.json index c8efe94..ceadfce 100644 --- a/vendor-bin/cs-fixer/composer.json +++ b/vendor-bin/cs-fixer/composer.json @@ -1,6 +1,6 @@ { "require-dev": { - "21torr/php-cs-fixer": "^1.0.2", + "21torr/php-cs-fixer": "^1.1.1", "roave/security-advisories": "dev-latest" } }