diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php index d5cade82a..55feadb14 100644 --- a/src/Composer/Package/BasePackage.php +++ b/src/Composer/Package/BasePackage.php @@ -142,14 +142,14 @@ abstract class BasePackage implements PackageInterface } /** - * Parses a version string and returns an array with the version and its type (dev, alpha, beta, RC, stable) + * Parses a version string and returns an array with the version, its type (alpha, beta, RC, stable) and a dev flag (for development branches tracking) * * @param string $version * @return array */ public static function parseVersion($version) { - if (!preg_match('#^v?(\d+)(\.\d+)?(\.\d+)?-?((?:beta|RC\d+|alpha|dev)\d*)?$#i', $version, $matches)) { + if (!preg_match('#^v?(\d+)(\.\d+)?(\.\d+)?-?((?:beta|RC\d+|alpha)\d*)?-?(dev)?$#i', $version, $matches)) { throw new \UnexpectedValueException('Invalid version string '.$version); } @@ -158,6 +158,7 @@ abstract class BasePackage implements PackageInterface .(!empty($matches[2]) ? $matches[2] : '.0') .(!empty($matches[3]) ? $matches[3] : '.0'), 'type' => strtolower(!empty($matches[4]) ? $matches[4] : 'stable'), + 'dev' => !empty($matches[5]), ); } } diff --git a/src/Composer/Package/LinkConstraint/VersionConstraint.php b/src/Composer/Package/LinkConstraint/VersionConstraint.php index 6e98d73a0..89b644b89 100644 --- a/src/Composer/Package/LinkConstraint/VersionConstraint.php +++ b/src/Composer/Package/LinkConstraint/VersionConstraint.php @@ -33,6 +33,7 @@ class VersionConstraint extends SpecificConstraint public function __construct($operator, $version) { // TODO add third parameter releaseType and match that too + // TODO add fourth parameter devSnapshot and match that too $this->operator = $operator; $this->version = $version; }