From 84f8fda0c6e75dbaa19b4333e1956ff8c2c09b8f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 30 Dec 2021 21:06:27 +0100 Subject: [PATCH] Remove getCode usage as it is not type safe apparently, see https://github.com/phpstan/phpstan-src/pull/795 --- .../DependencyResolver/SolverProblemsException.php | 8 ++++++++ src/Composer/Installer.php | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Composer/DependencyResolver/SolverProblemsException.php b/src/Composer/DependencyResolver/SolverProblemsException.php index 128fbe146..27deac4b3 100644 --- a/src/Composer/DependencyResolver/SolverProblemsException.php +++ b/src/Composer/DependencyResolver/SolverProblemsException.php @@ -39,6 +39,14 @@ class SolverProblemsException extends \RuntimeException parent::__construct('Failed resolving dependencies with '.count($problems).' problems, call getPrettyString to get formatted details', self::ERROR_DEPENDENCY_RESOLUTION_FAILED); } + /** + * @return self::ERROR_DEPENDENCY_RESOLUTION_FAILED + */ + public function getExitCode() + { + return self::ERROR_DEPENDENCY_RESOLUTION_FAILED; + } + /** * @param bool $isVerbose * @param bool $isDevExtraction diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index c78dc8fd7..78329042d 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -455,7 +455,7 @@ class Installer $ghe = new GithubActionError($this->io); $ghe->emit($err."\n".$prettyProblem); - return max(self::ERROR_GENERIC_FAILURE, $e->getCode()); + return max(self::ERROR_GENERIC_FAILURE, $e->getExitCode()); } $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE); @@ -633,7 +633,7 @@ class Installer $ghe = new GithubActionError($this->io); $ghe->emit($err."\n".$prettyProblem); - return max(self::ERROR_GENERIC_FAILURE, $e->getCode()); + return max(self::ERROR_GENERIC_FAILURE, $e->getExitCode()); } $lockTransaction->setNonDevPackages($nonDevLockTransaction); @@ -703,7 +703,7 @@ class Installer $ghe = new GithubActionError($this->io); $ghe->emit($err."\n".$prettyProblem); - return max(self::ERROR_GENERIC_FAILURE, $e->getCode()); + return max(self::ERROR_GENERIC_FAILURE, $e->getExitCode()); } }