Refactor: Replace jean85/pretty-package-versions with native Composer\InstalledVersions - #2171
Refactor: Replace jean85/pretty-package-versions with native Composer\InstalledVersions#2171peter17 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 184acee. Configure here.
| $prettyVersion = InstalledVersions::getPrettyVersion($package); | ||
|
|
||
| if ($prettyVersion !== null) { | ||
| self::$packages[$package] = $prettyVersion; |
There was a problem hiding this comment.
Dev versions lose commit identity
Medium Severity
PrettyVersions::getVersion()->getPrettyVersion() is not equivalent to InstalledVersions::getPrettyVersion(). For non-tagged installs, the former appended a short commit reference, while Composer’s API returns only the branch/pretty string. Module data on Sentry events can no longer identify the exact revision for branch or VCS packages.
Reviewed by Cursor Bugbot for commit 184acee. Configure here.
There was a problem hiding this comment.
If this is really an issue, would something like this be acceptable?
$prettyVersion = InstalledVersions::getPrettyVersion($package);
if ($prettyVersion !== null) {
$reference = InstalledVersions::getReference($package);
if ($reference !== null && str_starts_with($prettyVersion, 'dev-')) {
$prettyVersion .= '@' . substr($reference, 0, 7);
}
self::$packages[$package] = $prettyVersion;
}


Summary
Now that Composer 2 is standard across the ecosystem,
Composer\InstalledVersions(provided natively viacomposer-runtime-api^2.0) is available out of the box.This PR removes our dependency on
jean85/pretty-package-versionsand updatesModulesIntegration.phpto callComposer\InstalledVersions::getPrettyVersion()directly.Rationale
Composer\InstalledVersionsnatively, making third-party helper wrappers unnecessary for Composer 2+ environments.attack surface.
Changes
jean85/pretty-package-versionswith"composer-runtime-api": "^2.0".ModulesIntegration: Switched version resolution toInstalledVersions::getPrettyVersion($package)and removed Composer 1 legacy fallback logic.