Skip to content
This repository was archived by the owner on May 2, 2023. It is now read-only.

Commit 85a31d0

Browse files
Merge branch 'master' of github.com:vierbergenlars/php-semver
# By Jonathan Chan (1) and others # Via Lars Vierbergen (3) and Tom Rochette (1) * 'master' of github.com:vierbergenlars/php-semver: Update travis.yml configuration. Typo fixed in variable Make sure to throw the right exception (fixes #39) fixed reference in bin/semver to latest version of code - fixes #35
2 parents 4dc35f3 + be8b2a0 commit 85a31d0

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

.travis.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
language: php
2+
23
php:
34
- 5.3
45
- 5.4
5-
before_script: composer install --dev --prefer-source
6-
script: php tests/all_tests.php
6+
- 5.5
7+
- 5.6
8+
- 7.0
9+
- hhvm
10+
11+
matrix:
12+
allow_failures:
13+
- php: 7.0
14+
15+
before_script:
16+
- composer install --dev --prefer-source
17+
18+
script:
19+
- php tests/all_tests.php

bin/semver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function filter($versions, $ranges) {
107107
try {
108108
$v = new version($version);
109109
foreach ($ranges as $range) {
110-
if ($v->satisfies(new versionExpression($range)))
110+
if ($v->satisfies(new expression($range)))
111111
continue;
112112
$ok = false;
113113
break;

src/vierbergenlars/LibJs/RegExp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __construct($regex, $flags = '')
6767
public function exec($str)
6868
{
6969
if($this->global) {
70-
if(!preg_match_all($this->_pregSource, (string)$src, $matches))
70+
if(!preg_match_all($this->_pregSource, (string)$str, $matches))
7171
return null;
7272
} else {
7373
if(!preg_match($this->_pregSource, (string)$str, $matches))
@@ -93,4 +93,4 @@ public function valueOf()
9393
{
9494
return $this->regex;
9595
}
96-
}
96+
}

src/vierbergenlars/SemVer/version.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ class version
2121
*/
2222
public function __construct($version, $loose = false)
2323
{
24-
$this->version = new SemVer($version, $loose);
24+
try {
25+
$this->version = new SemVer($version, $loose);
26+
} catch(\RuntimeException $ex) {
27+
throw new SemVerException($ex->getMessage(), $version);
28+
}
2529
}
2630

2731
/**
@@ -92,7 +96,7 @@ public function valid()
9296
* Increment the version number
9397
* @param string $what One of 'major', 'minor', 'patch' or 'prerelease'
9498
* @return \vierbergenlars\SemVer\version
95-
* @throws SemVerException When an invalid increment value is given
99+
* @throws LogicException When an invalid increment value is given
96100
*/
97101
public function inc($what)
98102
{
@@ -122,7 +126,7 @@ public function __toString()
122126
* @param string $v2 The second version
123127
* @param bool $loose
124128
* @return bool
125-
* @throws UnexpectedValueException
129+
* @throws LogicException
126130
*/
127131
public static function cmp($v1, $cmp, $v2, $loose = false)
128132
{

0 commit comments

Comments
 (0)