diff --git a/src/Console/Command/SelfUpdateCommand.php b/src/Console/Command/SelfUpdateCommand.php index 2fa55e33..0531e1f0 100644 --- a/src/Console/Command/SelfUpdateCommand.php +++ b/src/Console/Command/SelfUpdateCommand.php @@ -131,6 +131,7 @@ private function updateToStableBuild() private function getStableUpdater(): Updater { $this->updater->setStrategy(Updater::STRATEGY_GITHUB); + return $this->getGithubReleasesUpdater($updater); } @@ -208,6 +209,7 @@ private function printVersion(Updater $updater) /** * @param Updater $updater + * * @return Updater */ private function getGithubReleasesUpdater(Updater $updater): Updater @@ -215,6 +217,7 @@ private function getGithubReleasesUpdater(Updater $updater): Updater $this->updater->getStrategy()->setPackageName(self::PACKAGIST_PACKAGE_NAME); $this->updater->getStrategy()->setPharName(self::REMOTE_FILENAME); $this->updater->getStrategy()->setCurrentLocalVersion($this->version); + return $updater; } diff --git a/src/Logger/UpdateConsoleLogger.php b/src/Logger/UpdateConsoleLogger.php index bfa5969e..3ec2ee54 100644 --- a/src/Logger/UpdateConsoleLogger.php +++ b/src/Logger/UpdateConsoleLogger.php @@ -15,8 +15,6 @@ namespace Humbug\PhpScoper\Logger; use Symfony\Component\Console\Application; -use Symfony\Component\Console\Output\NullOutput; -use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; /** @@ -50,11 +48,11 @@ public function updateSuccess(string $newVersion, string $oldVersion) { $this->io->writeln('PHP-Scoper has been updated.'); $this->io->writeln(sprintf( - 'Current version is: %s.', + 'Current version is: %s.', $newVersion )); $this->io->writeln(sprintf( - 'Previous version was: %s.', + 'Previous version was: %s.', $oldVersion )); } @@ -63,14 +61,17 @@ public function updateNotNeeded(string $oldVersion) { $this->io->writeln('PHP-Scoper is currently up to date.'); $this->io->writeln(sprintf( - 'Current version is: %s.', + 'Current version is: %s.', $oldVersion )); } public function error(\Exception $e) { - $this->io->writeln(sprintf('Error: %s', $e->getMessage())); + $this->io->writeln( + 'Unexpected error. If updating, your original phar is untouched.' + ); + $this->io->writeln(sprintf('%s', $e->getMessage())); } public function rollbackSuccess() @@ -86,7 +87,7 @@ public function rollbackFail() public function printLocalVersion(string $version) { $this->io->writeln(sprintf( - 'Your current local version is: %s', + 'Your current local version is: %s', $version )); } @@ -94,7 +95,7 @@ public function printLocalVersion(string $version) public function printRemoteVersion(string $stability, string $version) { $this->io->writeln(sprintf( - 'The current %s build available remotely is: %s', + 'The current %s build available remotely is: %s', $stability, $version )); @@ -102,11 +103,11 @@ public function printRemoteVersion(string $stability, string $version) public function noNewRemoteVersions(string $stability) { - $this->io->writeln(sprintf('There are no new %s builds available.', $stability)); + $this->io->writeln(sprintf('There are no new %s builds available.', $stability)); } public function currentVersionInstalled(string $stability) { - $this->io->writeln(sprintf('You have the current %s build installed.', $stability)); + $this->io->writeln(sprintf('You have the current %s build installed.', $stability)); } }