Skip to content

Commit fc7b3c2

Browse files
authored
Merge pull request #56 from boesing/feature/lowest-latest-php-aliases
Add `@lowest` and `@latest` alias to `php` configuration option
2 parents d0a7143 + 83a90ab commit fc7b3c2

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The "job" element will have the following elements, but is not restricted to the
8484

8585
```json
8686
{
87-
"php": "(optional) string PHP minor version to run against",
87+
"php": "(optional) string PHP minor version to run against; @lowest and @latest aliases point to the minimum and maximum PHP versions which are supported by the project",
8888
"extensions": [
8989
"(optional) extension names to install; names are from the ondrej PHP repository, minus the php{VERSION}- prefix"
9090
],

src/additional-checks.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ const discoverPhpVersionsForCheck = function (job, config) {
5050
}
5151

5252
if (typeof job.php === 'string') {
53+
if (job.php === '@lowest') {
54+
return [config.minimum_version];
55+
}
56+
57+
if (job.php === '@latest') {
58+
return [config.latest_version];
59+
}
60+
5361
return [job.php];
5462
}
5563

src/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class Config {
4444
versions = [];
4545
stable_version = CURRENT_STABLE;
4646
minimum_version = CURRENT_STABLE;
47+
latest_version = CURRENT_STABLE;
4748
locked_dependencies = false;
4849
extensions = [];
4950
php_ini = ['memory_limit = -1'];
@@ -69,10 +70,12 @@ class Config {
6970
if (configuration["stablePHP"] !== undefined) {
7071
this.stable_version = configuration["stablePHP"];
7172
this.minimum_version = this.stable_version;
73+
this.latest_version = this.stable_version;
7274
}
7375

7476
if (this.versions.length > 0) {
7577
this.minimum_version = this.versions[0]
78+
this.latest_version = this.versions[this.versions.length - 1]
7679
}
7780

7881
if (configuration.extensions !== undefined && Array.isArray(configuration.extensions)) {

0 commit comments

Comments
 (0)