Skip to content
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

Closed
nickvergessen opened this issue Dec 12, 2014 · 6 comments
Closed

Extract methods from VersionParser.php into it's own package #3545

nickvergessen opened this issue Dec 12, 2014 · 6 comments

Comments

@nickvergessen
Copy link

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:

@alcohol
Copy link
Member

alcohol commented Dec 14, 2014

I had a look at this, but it isn't as easy as it sounds. The Composer\Package\Version\ namespace contains a lot of functions that depend on other namespaces (most of them also within Composer\Package\).

It would require quite some refactoring to cleanly separate it.

@lavoiesl
Copy link

I often have to include the whole Composer project to be able to manipulate package information, including json and versions. Perhaps a composer/schema project would be useful.

@legoktm
Copy link
Contributor

legoktm commented May 21, 2015

+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 and all the classes implementing LinkConstraintInterface.

VersionParser currently depends on other parts of composer outside of LinkConstraintInterface in:

  • parseConstraints - BasePackage::$stabilities
  • parseConstraint - BasePackage::$stabilities
  • parseLinks - returns Link's
  • formatVersion - uses PackageInterface

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.

legoktm added a commit to legoktm/composer that referenced this issue May 31, 2015
…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.
@Seldaek Seldaek added this to the Backwards Compatible milestone May 31, 2015
legoktm added a commit to legoktm/composer that referenced this issue Jul 2, 2015
…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.
legoktm added a commit to legoktm/composer that referenced this issue Jul 4, 2015
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().
legoktm added a commit to legoktm/composer that referenced this issue Jul 4, 2015
Working towards composer#3545.

parseLinks is a wrapper around VersionParser::parseConstraints() that
creates Link objects, and better belongs in ArrayLoader.
@legoktm
Copy link
Contributor

legoktm commented Jul 4, 2015

@legoktm
Copy link
Contributor

legoktm commented Jul 15, 2015

I think we can close this now that https://github.com/composer/semver exists :)

@Seldaek
Copy link
Member

Seldaek commented Jul 17, 2015

@Seldaek Seldaek closed this as completed Jul 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants