From 9815bbba4535b0605aef5b5cb9dd64a63bc44b1f Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Mon, 9 Sep 2024 09:56:48 +0200 Subject: [PATCH] PHPStan Pro: debug corrupted PHAR signature message --- src/Command/FixerApplication.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Command/FixerApplication.php b/src/Command/FixerApplication.php index 6236c3c63f..40668741d9 100644 --- a/src/Command/FixerApplication.php +++ b/src/Command/FixerApplication.php @@ -49,6 +49,7 @@ use function fclose; use function fopen; use function fwrite; +use function get_class; use function getenv; use function http_build_query; use function ini_get; @@ -240,10 +241,11 @@ private function getFixerProcess(OutputInterface $output, int $serverPort): Proc try { $phar = new Phar($pharPath); - } catch (Throwable) { + } catch (Throwable $e) { @unlink($pharPath); @unlink($infoPath); $output->writeln('PHPStan Pro PHAR signature is corrupted.'); + $output->writeln(sprintf('%s: %s', get_class($e), $e->getMessage())); throw new FixerProcessException(); } @@ -252,6 +254,7 @@ private function getFixerProcess(OutputInterface $output, int $serverPort): Proc @unlink($pharPath); @unlink($infoPath); $output->writeln('PHPStan Pro PHAR signature is corrupted.'); + $output->writeln(sprintf('Wrong hash type: %s', $phar->getSignature()['hash_type'])); throw new FixerProcessException(); }