Skip to content

Commit 68328f5

Browse files
committed
Merge pull request #2 from jenolan/master
Missed that there was a regex as well as inline parsing
2 parents 89b3c14 + fcf46a2 commit 68328f5

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/Version/Stability.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
namespace Version;
44

5-
use JsonSchema\Exception\InvalidArgumentException;
6-
75
class Stability
86
{
97

10-
const REGEX = '[-|_|\.]{0,1}([R|r][C|c]|pl|a|alpha|[B|b][E|e][T|t][A|a]|b|B|patch|stable|p)\.{0,1}(\d*)';
8+
const REGEX = '[-|_|\.]{0,1}([R|r][C|c]|pl|a|alpha|[B|b][E|e][T|t][A|a]|b|B|patch|stable|p|[D|d][E|e][V|v]|[D|d])\.{0,1}(\d*)';
119

1210
/**
1311
* @var string
@@ -109,7 +107,7 @@ private function toInt( $stability )
109107
case 'patch':
110108
return 6;
111109
default:
112-
throw new InvalidArgumentException( 'Invalid stability: ' . $stability );
110+
throw new \InvalidArgumentException( 'Invalid stability: ' . $stability );
113111
}
114112
}
115113
}

src/Version/Version.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ public function __toString()
208208
$version =
209209
$this->major . '.' .
210210
$this->minor . '.' .
211-
$this->revision . '.' .
212-
(int)$this->micro;
211+
$this->revision;
212+
if($this->micro !== null) $version .= '.' . (int)$this->micro;
213213
} else {
214214
$version = $this->major;
215215
if ($this->minor) $version .= '-' . $this->minor;

0 commit comments

Comments
 (0)