Skip to content

Commit 69fd13c

Browse files
Make it compatible with the snapshot version
1 parent 5fd2e0c commit 69fd13c

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎Converter/SemverUtil.php‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public static function replaceAlias($version, $type)
4444
*/
4545
public static function convertVersionMetadata($version)
4646
{
47-
if (preg_match_all(self::createPattern('([a-z]+|(\-|\+)[a-z]+|(\-|\+)[0-9]+)'),
47+
if (preg_match_all(self::createPattern('([a-zA-Z]+|(\-|\+)[a-zA-Z]+|(\-|\+)[0-9]+)'),
4848
$version, $matches, PREG_OFFSET_CAPTURE)) {
49-
list($type, $version, $end) = self::cleanVersion($version, $matches);
49+
list($type, $version, $end) = self::cleanVersion(strtolower($version), $matches);
5050
list($version, $patchVersion) = self::matchVersion($version, $type);
5151

5252
$matches = array();
@@ -131,7 +131,8 @@ protected static function matchVersion($version, $type)
131131
{
132132
$patchVersion = true;
133133

134-
if ('dev' === $type) {
134+
if (in_array($type, array('dev', 'snapshot'))) {
135+
$type = 'dev';
135136
$patchVersion = false;
136137
} elseif ('a' === $type) {
137138
$type = 'alpha';

‎Resources/doc/schema.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ Here are the matches currently validated:
173173
| 1.2.3-build2012 | 1.2.3-patch2012 |
174174
| 1.2.3+build.2012 | 1.2.3-patch.2012 |
175175
| 1.2.3-build.2012 | 1.2.3-patch.2012 |
176+
| 1.2.3-SNAPSHOT | 1.2.3-dev |
177+
| 1.2.3-snapshot | 1.2.3-dev |
176178
| latest | default |
177179

178180
##### Range verison conversion

‎Tests/Converter/SemverConverterTest.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public function getTestVersions()
8686
array('1.2.3+build.2012', '1.2.3-patch.2012'),
8787
array('1.2.3-build.2012', '1.2.3-patch.2012'),
8888
array('1.3.0–rc30.79', '1.3.0-RC30.79'),
89+
array('1.2.3-SNAPSHOT', '1.2.3-dev'),
8990
array('latest', 'default || *'),
9091
array(null, '*'),
9192
array('', '*'),

0 commit comments

Comments
 (0)