diff --git a/CHANGELOG.md b/CHANGELOG.md index b9ce646..e9c450b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +1.3.2 +===== + +* (bug) Remove breaking rule. + + +1.3.1 +===== + +* (improvement) Bump required PHP-CS-Fixer versions. +* (improvement) Make PHP-CS-Fixer script calls clearer. + + 1.3.0 ===== diff --git a/_init/library/vendor-bin/cs-fixer/composer.json b/_init/library/vendor-bin/cs-fixer/composer.json index c8efe94..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.0.2", + "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 c8efe94..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.0.2", + "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<string, string> $scripts The scripts to replace. + * @param string $key the scripts key to update + * @param array<string, string> $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/src/Initializer/LibraryInitializer.php b/src/Initializer/LibraryInitializer.php index 781824f..79b8455 100644 --- a/src/Initializer/LibraryInitializer.php +++ b/src/Initializer/LibraryInitializer.php @@ -41,7 +41,7 @@ public function initialize (TorrStyle $io) : int ]); $helper->updateProjectComposerJsonScripts("lint", [ "normalize" => "@composer bin c-norm normalize \"$(pwd)/composer.json\" --indent-style tab --indent-size 1 --dry-run --ansi", - "cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer fix --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --dry-run --no-interaction --ansi", + "cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer check --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --no-interaction --ansi", ]); $helper->updateProjectComposerJsonScripts("test", [ "phpstan" => "vendor-bin/phpstan/vendor/bin/phpstan analyze -c phpstan.neon . --ansi", diff --git a/src/Initializer/SymfonyInitializer.php b/src/Initializer/SymfonyInitializer.php index 1dbc1ef..3ced3fb 100644 --- a/src/Initializer/SymfonyInitializer.php +++ b/src/Initializer/SymfonyInitializer.php @@ -43,7 +43,7 @@ public function initialize (TorrStyle $io) : int "lint:yaml" => "bin/console lint:yaml config --parse-tags", "lint:twig" => "bin/console lint:twig templates", "normalize" => "@composer bin c-norm normalize \"$(pwd)/composer.json\" --indent-style tab --indent-size 1 --dry-run --ansi", - "cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer fix --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --dry-run --no-interaction --ansi", + "cs-fixer" => "vendor-bin/cs-fixer/vendor/bin/php-cs-fixer check --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --no-interaction --ansi", ]); $helper->updateProjectComposerJsonScripts("test", [ "phpstan" => "vendor-bin/phpstan/vendor/bin/phpstan analyze -c phpstan.neon . --ansi", 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" } }