setup-php 2.36.0 → 2.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/utils.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import fs from 'fs';
2
2
  import * as path from 'path';
3
- import * as core from '@actions/core';
3
+ import * as core from './core';
4
4
  import * as fetch from './fetch';
5
5
 
6
6
  /**
@@ -62,7 +62,7 @@ export async function getManifestURLS(): Promise<string[]> {
62
62
  */
63
63
  export async function parseVersion(version: string): Promise<string> {
64
64
  switch (true) {
65
- case /^(latest|lowest|highest|nightly|\d+\.x)$/.test(version):
65
+ case /^(latest|lowest|highest|nightly|master|\d+\.x)$/.test(version):
66
66
  for (const manifestURL of await getManifestURLS()) {
67
67
  const fetchResult = await fetch.fetch(manifestURL);
68
68
  if (fetchResult['data'] ?? false) {
@@ -97,9 +97,8 @@ export async function parseIniFile(ini_file: string): Promise<string> {
97
97
  }
98
98
 
99
99
  /**
100
- * Async foreach loop
100
+ * Async foreach loop using modern for...of pattern
101
101
  *
102
- * @author https://github.com/Atinux
103
102
  * @param array
104
103
  * @param callback
105
104
  */
@@ -111,8 +110,8 @@ export async function asyncForEach(
111
110
  array: Array<string>
112
111
  ) => Promise<void>
113
112
  ): Promise<void> {
114
- for (let index = 0; index < array.length; index++) {
115
- await callback(array[index], index, array);
113
+ for (const [index, element] of array.entries()) {
114
+ await callback(element, index, array);
116
115
  }
117
116
  }
118
117