Skip to content

Commit c0074f1

Browse files
committed
Allow generating PHAR with a stable prefix
1 parent 3f5686b commit c0074f1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

compiler/build/scoper.inc.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@
3030
$stubs[] = $file->getPathName();
3131
}
3232

33-
exec('git rev-parse --short HEAD', $gitCommitOutputLines, $gitExitCode);
34-
if ($gitExitCode !== 0) {
35-
die('Could not get Git commit');
33+
if ($_SERVER['PHAR_CHECKSUM'] ?? false) {
34+
$prefix = '_PHPStan_checksum';
35+
} else {
36+
exec('git rev-parse --short HEAD', $gitCommitOutputLines, $gitExitCode);
37+
if ($gitExitCode !== 0) {
38+
die('Could not get Git commit');
39+
}
40+
41+
$prefix = sprintf('_PHPStan_%s', $gitCommitOutputLines[0]);
3642
}
3743

3844
return [
39-
'prefix' => sprintf('_PHPStan_%s', $gitCommitOutputLines[0]),
45+
'prefix' => $prefix,
4046
'finders' => [],
4147
'files-whitelist' => $stubs,
4248
'patchers' => [

0 commit comments

Comments
 (0)