Skip to content

Commit

Permalink
PHPStan Pro: debug corrupted PHAR signature message
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 9, 2024
1 parent 77405e8 commit 9815bbb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Command/FixerApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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('<fg=red>PHPStan Pro PHAR signature is corrupted.</>');
$output->writeln(sprintf('%s: %s', get_class($e), $e->getMessage()));

throw new FixerProcessException();
}
Expand All @@ -252,6 +254,7 @@ private function getFixerProcess(OutputInterface $output, int $serverPort): Proc
@unlink($pharPath);
@unlink($infoPath);
$output->writeln('<fg=red>PHPStan Pro PHAR signature is corrupted.</>');
$output->writeln(sprintf('Wrong hash type: %s', $phar->getSignature()['hash_type']));

throw new FixerProcessException();
}
Expand Down

0 comments on commit 9815bbb

Please sign in to comment.