Skip to content

Commit 6dc68c3

Browse files
authored
Fix the version used in the PHAR (#259)
Closes #257
1 parent e7eb4b8 commit 6dc68c3

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/fixtures/set004/scoper.inc.php
99
/fixtures/*/.box_dump/
1010
/fixtures/*/vendor/
11+
.phpunit*
1112
/vendor/
1213
/vendor-bin/*/vendor/
1314
/vendor-bin/*/bin/

box.json.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"files": [
88
"src/scoper.inc.php.tpl"
99
],
10+
"git": "git_version_placeholder",
1011

1112
"compression": "GZ",
1213

src/functions.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,13 @@ function create_application(): SymfonyApplication
6666
*/
6767
function get_version(): string
6868
{
69+
if ('phar:' === substr(__FILE__, 0, 5)) {
70+
return '@git_version_placeholder@';
71+
}
72+
6973
$rawVersion = Versions::getVersion('humbug/php-scoper');
7074

71-
list($prettyVersion, $commitHash) = explode('@', $rawVersion);
75+
[$prettyVersion, $commitHash] = explode('@', $rawVersion);
7276

7377
return (1 === preg_match('/9{7}/', $prettyVersion)) ? $commitHash : $prettyVersion;
7478
}

0 commit comments

Comments
 (0)