From 081ead163586a0201c2925e24e8d521dc7cd152c Mon Sep 17 00:00:00 2001 From: Beau Simensen Date: Sat, 6 Oct 2012 07:32:16 -0700 Subject: [PATCH] Version Parsing: Consider Consider ` of the cases that's what the intent is. Could be > overriden with `parseStability($version) === 'stable') { $version .= '-' . $stabilityModifier; + } elseif ('<' === $matches[1]) { + if (!preg_match('/-stable$/', strtolower($matches[2]))) { + $version .= '-dev'; + } } return array(new VersionConstraint($matches[1] ?: '=', $version)); diff --git a/tests/Composer/Test/Package/Version/VersionParserTest.php b/tests/Composer/Test/Package/Version/VersionParserTest.php index 45cfb7848..764cfd982 100644 --- a/tests/Composer/Test/Package/Version/VersionParserTest.php +++ b/tests/Composer/Test/Package/Version/VersionParserTest.php @@ -195,7 +195,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase 'not equal' => array('<>1.0.0', new VersionConstraint('<>', '1.0.0.0')), 'not equal/2' => array('!=1.0.0', new VersionConstraint('!=', '1.0.0.0')), 'greater than' => array('>1.0.0', new VersionConstraint('>', '1.0.0.0')), - 'lesser than' => array('<1.2.3.4', new VersionConstraint('<', '1.2.3.4')), + 'lesser than' => array('<1.2.3.4', new VersionConstraint('<', '1.2.3.4-dev')), 'less/eq than' => array('<=1.2.3', new VersionConstraint('<=', '1.2.3.0')), 'great/eq than' => array('>=1.2.3', new VersionConstraint('>=', '1.2.3.0')), 'equals' => array('=1.2.3', new VersionConstraint('=', '1.2.3.0')), @@ -209,6 +209,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase 'regression #550' => array('dev-some-fix', new VersionConstraint('=', 'dev-some-fix')), 'regression #935' => array('dev-CAPS', new VersionConstraint('=', 'dev-CAPS')), 'ignores aliases' => array('dev-master as 1.0.0', new VersionConstraint('=', '9999999-dev')), + 'lesser than override' => array('<1.2.3.4-stable', new VersionConstraint('<', '1.2.3.4')), ); }