Skip to content

Commit 2d7a8c0

Browse files
authored
feat: Remove composer/package-versions-deprecated (#804)
1 parent 9a9b5c8 commit 2d7a8c0

File tree

3 files changed

+6
-81
lines changed

3 files changed

+6
-81
lines changed

composer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
],
1919
"require": {
2020
"php": "^8.1",
21-
"composer/package-versions-deprecated": "^1.8",
2221
"fidry/console": "^0.5.0",
2322
"jetbrains/phpstorm-stubs": "^v2022.2",
2423
"nikic/php-parser": "^4.12",
@@ -63,7 +62,6 @@
6362
"config": {
6463
"allow-plugins": {
6564
"bamarni/composer-bin-plugin": true,
66-
"composer/package-versions-deprecated": true,
6765
"ergebnis/composer-normalize": true
6866
},
6967
"bin-dir": "bin",

composer.lock

Lines changed: 1 addition & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/functions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
namespace Humbug\PhpScoper;
1616

17+
use Composer\InstalledVersions;
1718
use Iterator;
18-
use PackageVersions\Versions;
1919
use function array_pop;
2020
use function count;
2121
use function str_split;
@@ -31,11 +31,11 @@ function get_php_scoper_version(): string
3131
return '@git_version_placeholder@';
3232
}
3333

34-
$rawVersion = Versions::getVersion('humbug/php-scoper');
34+
$prettyVersion = InstalledVersions::getPrettyVersion('humbug/php-scoper');
35+
$commitHash = InstalledVersions::getReference('humbug/php-scoper');
36+
$shortCommitHash = null === $commitHash ? 'local' : substr($commitHash, 0, 7);
3537

36-
[$prettyVersion, $commitHash] = explode('@', $rawVersion);
37-
38-
return $prettyVersion.'@'.substr($commitHash, 0, 7);
38+
return $prettyVersion.'@'.$shortCommitHash;
3939
}
4040

4141
/**

0 commit comments

Comments
 (0)