-
-
Notifications
You must be signed in to change notification settings - Fork 38
Plugin: use Composer API 2.x methods #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The Composer runtime-api 2.0 introduced the `\Composer\InstalledVersions::isInstalled()` method. This commit starts using that method. Implementation choices: While it would be possible to also handle the version checking via `Composer\InstalledVersions::satisfies(new VersionParser, self::PACKAGE_NAME, (string) $versionConstraint)`, this would require adding a new dependency `"composer/semver": "^3.0"`. For now, I've chosen not to add the dependency and to leave the pre-existing code for handling version constraints. Ref: https://getcomposer.org/doc/07-runtime.md#installed-versions
The Composer runtime-api 2.1 introduced the `\Composer\InstalledVersions::getInstallPath()` method. This commit starts using that method. Ref: https://getcomposer.org/doc/07-runtime.md#knowing-the-path-in-which-a-package-is-installed
012a35b to
7b7cbbd
Compare
|
Hang on - this PR still contained a commit from another PR, so I've rebased this to drop that extraneous commit (without other changes) |
Potherca
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just to be clear: We're breaking backward compatibility on purpose, right?
I.e, we're not checking whether Composer\InstalledVersions exist, as we are bumping the required version of composer to versions that are quaranteed to contain Composer\InstalledVersions.
(Just double-checking, as I've been out of touch with this project for a while).
Exactly, the version bump for the Composer API was already done in PR #230 and as this tool is a Composer plugin and therefore only needs to take installation via Composer into account, we don't need to check with |
Proposed Changes
Modernize: use InstalledVersions::isInstalled()
The Composer runtime-api 2.0 introduced the
\Composer\InstalledVersions::isInstalled()method.This commit starts using that method.
Implementation choices:
While it would be possible to also handle the version checking via
Composer\InstalledVersions::satisfies(new VersionParser, self::PACKAGE_NAME, (string) $versionConstraint), this would require adding a new dependency"composer/semver": "^3.0".For now, I've chosen not to add the dependency and to leave the pre-existing code for handling version constraints.
Ref: https://getcomposer.org/doc/07-runtime.md#installed-versions
Modernize: use InstalledVersions::getInstallPath()
The Composer runtime-api 2.1 introduced the
\Composer\InstalledVersions::getInstallPath()method.This commit starts using that method.
Ref: https://getcomposer.org/doc/07-runtime.md#knowing-the-path-in-which-a-package-is-installed
Related Issues
Follow up on #230
👉🏻 Note: I have another modernization lined up, but am running into a bug in Composer. Holding that one back for now.