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
Extract methods from VersionParser.php into it's own package #3545
Comments
|
I had a look at this, but it isn't as easy as it sounds. The It would require quite some refactoring to cleanly separate it. |
|
I often have to include the whole Composer project to be able to manipulate package information, including json and versions. Perhaps a |
|
+1 I'm specifically interested in doing this for MediaWiki, where we would like to re-use composer's version parsing code instead of writing our own. I think we would want to include VersionParser currently depends on other parts of composer outside of LinkConstraintInterface in:
I don't think it would be too difficult to move those methods somewhere else, and I would be willing to work on a patch that did that. |
…ion() Working towards composer#3545. formatVersion() does not belong in VersionParser since it depends upon a Package object, and is creating a more complete pretty formatted version, not parsing anything. The new getFullPrettyVersion() method can be seen as an extension to getPrettyVersion(), and is located in BasePackage as a result. Callers to VersionParser::formatVersion() were not updated in this commit to demonstrate that no functionality was changed in this refactor. They will be updated in a follow up commit.
…ion() Working towards composer#3545. formatVersion() does not belong in VersionParser since it depends upon a Package object, and is creating a more complete pretty formatted version, not parsing anything. The new getFullPrettyVersion() method can be seen as an extension to getPrettyVersion(), and is located in BasePackage as a result. Callers to VersionParser::formatVersion() were not updated in this commit to demonstrate that no functionality was changed in this refactor. They will be updated in a follow up commit.
Working towards composer#3545. This adds VersionParser::$stabilities, which is an array of the supported stability levels. This adds a little bit of duplication, however we were already hardcoding the various stabilities in regular expressions and functions like parseStability().
Working towards composer#3545. parseLinks is a wrapper around VersionParser::parseConstraints() that creates Link objects, and better belongs in ArrayLoader.
|
|
I think we can close this now that https://github.com/composer/semver exists :) |
Composer\Package\Version\VersionParser has some good methods dealing with versions which would be nice to have in a seperate project, so they can be reused instead of either copy pasting them or relying on the whole composer package.
This especially applies to the following methods:
The text was updated successfully, but these errors were encountered: