From 1ba53c44c52d1d3fa90ed9fcbf3f4acd3c5a4e29 Mon Sep 17 00:00:00 2001 From: Larry Lewis Date: Sat, 6 Jun 2015 15:18:20 +1000 Subject: [PATCH 1/3] Missed that there was a regex as well as inline parsing --- src/Version/Stability.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Version/Stability.php b/src/Version/Stability.php index 5b715c7..33042a1 100644 --- a/src/Version/Stability.php +++ b/src/Version/Stability.php @@ -7,7 +7,7 @@ class Stability { - 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*)'; + 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*)'; /** * @var string From a2f78bfe65e744673336d80c6e5689e414afe11b Mon Sep 17 00:00:00 2001 From: Larry Lewis Date: Sat, 6 Jun 2015 15:28:39 +1000 Subject: [PATCH 2/3] Incorrect exception callout --- src/Version/Stability.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Version/Stability.php b/src/Version/Stability.php index 33042a1..e141cba 100644 --- a/src/Version/Stability.php +++ b/src/Version/Stability.php @@ -2,8 +2,6 @@ namespace Version; -use JsonSchema\Exception\InvalidArgumentException; - class Stability { @@ -109,7 +107,7 @@ private function toInt( $stability ) case 'patch': return 6; default: - throw new InvalidArgumentException( 'Invalid stability: ' . $stability ); + throw new \InvalidArgumentException( 'Invalid stability: ' . $stability ); } } } From fcf46a29e520788d7504c7763c39a7db988d606b Mon Sep 17 00:00:00 2001 From: Larry Lewis Date: Sat, 6 Jun 2015 15:32:30 +1000 Subject: [PATCH 3/3] For semantic version capability if micro is null do not show it, if set to 0 will display. --- src/Version/Version.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Version/Version.php b/src/Version/Version.php index 7c0c1e7..e9d3c81 100644 --- a/src/Version/Version.php +++ b/src/Version/Version.php @@ -208,8 +208,8 @@ public function __toString() $version = $this->major . '.' . $this->minor . '.' . - $this->revision . '.' . - (int)$this->micro; + $this->revision; + if($this->micro !== null) $version .= '.' . (int)$this->micro; } else { $version = $this->major; if ($this->minor) $version .= '-' . $this->minor;