From 892dde279bd60ab462b7d6d2fd785fadfe457d82 Mon Sep 17 00:00:00 2001 From: Jakob Linskeseder Date: Mon, 18 Nov 2019 15:17:33 +0100 Subject: [PATCH] Handle PHPCBF exit codes correctly The previously used code-fixer returned different exit codes. With PHPCBF, we don't have to handle exit codes at all, since the result (success, error) is printed on the command line. --- src/CodeStyleFixer.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/CodeStyleFixer.php b/src/CodeStyleFixer.php index fc87326..e12e668 100644 --- a/src/CodeStyleFixer.php +++ b/src/CodeStyleFixer.php @@ -32,12 +32,10 @@ public static function run(Event $event) $composerIO->write($process->getOutput()); - $exitCode = $process->getExitCode(); - - if ($exitCode !== ComposerScriptInterface::EXIT_CODE_OK) { - throw new ProcessFailedException($process); - } - - return $exitCode; + // PHPCBF exit codes: + // 0 = Nothing was fixed by PHPCBF. + // 1 = PHPCBF fixed all fixable errors. + // 2 = PHPCBF fixed some fixable errors, but others failed to fix. + return $process->getExitCode(); } }