diff --git a/README.md b/README.md index 4bad5564..06819f47 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ with: These tools can be setup globally using the `tools` input. -`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-prefetcher`, `cs2pr`, `deployer`, `flex`, `infection`, `pecl`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`, `symfony`, `vapor-cli` +`blackfire`, `blackfire-player`, `codeception`, `composer`, `composer-prefetcher`, `cs2pr`, `deployer`, `flex`, `infection`, `pecl`, `phan`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`, `symfony`, `vapor-cli` ```yaml uses: shivammathur/setup-php@v2 @@ -367,7 +367,7 @@ Run the workflow locally with `act` using [`shivammathur/node`](https://github.c act -P ubuntu-latest=shivammathur/node:latest # For runs-on: ubuntu-18.04 -act -P ubuntu-18.04=shivammathur/node:latest +act -P ubuntu-18.04=shivammathur/node:bionic # For runs-on: ubuntu-16.04 act -P ubuntu-16.04=shivammathur/node:xenial diff --git a/__tests__/install.test.ts b/__tests__/install.test.ts index f48dcd2b..a537558a 100644 --- a/__tests__/install.test.ts +++ b/__tests__/install.test.ts @@ -69,6 +69,7 @@ jest.mock('../src/install', () => ({ * @param extension_csv * @param ini_values_csv * @param coverage_driver + * @param tools */ function setEnv( version: string | number, @@ -76,8 +77,7 @@ function setEnv( extension_csv: string, ini_values_csv: string, coverage_driver: string, - tools: string, - pecl: string + tools: string ): void { process.env['php-version'] = version.toString(); process.env['RUNNER_OS'] = os; @@ -85,26 +85,25 @@ function setEnv( process.env['ini-values'] = ini_values_csv; process.env['coverage'] = coverage_driver; process.env['tools'] = tools; - process.env['pecl'] = pecl; } describe('Install', () => { it('Test install on windows', async () => { - setEnv('7.0', 'win32', '', '', '', '', ''); - // @ts-ignore - let script: string = await install.run(); + setEnv('7.0', 'win32', '', '', '', ''); + + let script: string = '' + (await install.run()); expect(script).toContain('initial script'); expect(script).toContain('pwsh script.ps1 7.0 ' + __dirname); - setEnv('7.3', 'win32', '', '', '', '', ''); - // @ts-ignore - script = await install.run(); + setEnv('7.3', 'win32', '', '', '', ''); + + script = '' + (await install.run()); expect(script).toContain('initial script'); expect(script).toContain('pwsh script.ps1 7.3 ' + __dirname); - setEnv('7.3', 'win32', 'a, b', 'a=b', 'x', '', ''); - // @ts-ignore - script = await install.run(); + setEnv('7.3', 'win32', 'a, b', 'a=b', 'x', ''); + + script = '' + (await install.run()); expect(script).toContain('initial script'); expect(script).toContain('install extensions'); expect(script).toContain('edit php.ini'); @@ -113,25 +112,15 @@ describe('Install', () => { }); it('Test install on linux', async () => { - setEnv('7.3', 'linux', '', '', '', '', ''); - // @ts-ignore - let script: string = await install.run(); + setEnv('7.3', 'linux', '', '', '', ''); + + let script: string = '' + (await install.run()); expect(script).toContain('initial script'); expect(script).toContain('bash script.sh 7.3 '); - setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit', 'true'); - // @ts-ignore - script = await install.run(); - expect(script).toContain('initial script'); - expect(script).toContain('install extensions'); - expect(script).toContain('edit php.ini'); - expect(script).toContain('set coverage driver'); - expect(script).toContain('bash script.sh 7.3'); - expect(script).toContain('add_tool'); + setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit'); - setEnv('7.3', 'linux', 'a, b', 'a=b', 'x', 'phpunit', ''); - // @ts-ignore - script = await install.run(); + script = '' + (await install.run()); expect(script).toContain('initial script'); expect(script).toContain('install extensions'); expect(script).toContain('edit php.ini'); @@ -141,15 +130,15 @@ describe('Install', () => { }); it('Test install on darwin', async () => { - setEnv('7.3', 'darwin', '', '', '', '', ''); - // @ts-ignore - let script: string = await install.run(); + setEnv('7.3', 'darwin', '', '', '', ''); + + let script: string = '' + (await install.run()); expect(script).toContain('initial script'); expect(script).toContain('bash script.sh 7.3 ' + __dirname); - setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x', '', ''); - // @ts-ignore - script = await install.run(); + setEnv('7.3', 'darwin', 'a, b', 'a=b', 'x', ''); + + script = '' + (await install.run()); expect(script).toContain('initial script'); expect(script).toContain('install extensions'); expect(script).toContain('edit php.ini'); @@ -158,21 +147,21 @@ describe('Install', () => { }); it('Test malformed version inputs', async () => { - setEnv('7.4.1', 'darwin', '', '', '', '', ''); - // @ts-ignore - let script: string = await install.run(); + setEnv('7.4.1', 'darwin', '', '', '', ''); + + let script: string = '' + '' + (await install.run()); expect(script).toContain('initial script'); expect(script).toContain('bash script.sh 7.4 ' + __dirname); - setEnv(8.0, 'darwin', '', '', '', '', ''); - // @ts-ignore - script = await install.run(); + setEnv(8.0, 'darwin', '', '', '', ''); + + script = '' + (await install.run()); expect(script).toContain('initial script'); expect(script).toContain('bash script.sh 8.0 ' + __dirname); - setEnv(8, 'darwin', '', '', '', '', ''); - // @ts-ignore - script = await install.run(); + setEnv(8, 'darwin', '', '', '', ''); + + script = '' + (await install.run()); expect(script).toContain('initial script'); expect(script).toContain('bash script.sh 8.0 ' + __dirname); }); diff --git a/__tests__/tools.test.ts b/__tests__/tools.test.ts index 8a16d45c..07c2394e 100644 --- a/__tests__/tools.test.ts +++ b/__tests__/tools.test.ts @@ -391,7 +391,7 @@ describe('Tools tests', () => { }); it('checking addTools on darwin', async () => { const script: string = await tools.addTools( - 'blackfire, blackfire-player, flex, infection, phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, vapor-cli, phive:1.2.3, cs2pr:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3, wp-cli', + 'blackfire, blackfire-player, flex, infection, phan, phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, vapor-cli, phan:2.7.2, phive:1.2.3, cs2pr:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3, wp-cli', '7.4', 'darwin' ); @@ -408,6 +408,9 @@ describe('Tools tests', () => { expect(script).toContain( 'add_tool https://github.com/infection/infection/releases/latest/download/infection.phar infection' ); + expect(script).toContain( + 'add_tool https://github.com/phan/phan/releases/latest/download/phan.phar phan' + ); expect(script).toContain( 'add_tool https://github.com/squizlabs/PHP_CodeSniffer/releases/latest/download/phpcs.phar phpcs' ); @@ -426,6 +429,9 @@ describe('Tools tests', () => { expect(script).toContain('add_composertool vapor-cli vapor-cli laravel/'); expect(script).toContain('add_composertool flex flex symfony/'); expect(script).toContain('add_composertool phinx phinx robmorgan/'); + expect(script).toContain( + 'add_tool https://github.com/phan/phan/releases/download/2.7.2/phan.phar phan' + ); expect(script).toContain( 'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive' ); diff --git a/dist/index.js b/dist/index.js index 012c0eeb..0d889f9b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1987,6 +1987,10 @@ async function addTools(tools_csv, php_version, os_version) { url = github + 'squizlabs/PHP_CodeSniffer/' + uri; script += await addArchive(tool, version, url, os_version); break; + case 'phan': + url = github + 'phan/phan/' + uri; + script += await addArchive(tool, version, url, os_version); + break; case 'phive': script += await addPhive(version, os_version); break; @@ -2670,7 +2674,7 @@ const utils = __importStar(__webpack_require__(163)); async function addExtensionDarwin(extension_csv, version, pipe) { const extensions = await utils.extensionArray(extension_csv); let add_script = '\n'; - let remove_script = '\n'; + let remove_script = ''; await utils.asyncForEach(extensions, async function (extension) { const version_extension = version + extension; const [ext_name, ext_version] = extension.split('-'); @@ -2777,7 +2781,7 @@ exports.addExtensionDarwin = addExtensionDarwin; async function addExtensionWindows(extension_csv, version) { const extensions = await utils.extensionArray(extension_csv); let add_script = '\n'; - let remove_script = '\n'; + let remove_script = ''; await utils.asyncForEach(extensions, async function (extension) { const [ext_name, ext_version] = extension.split('-'); const version_extension = version + extension; @@ -2859,7 +2863,7 @@ exports.addExtensionWindows = addExtensionWindows; async function addExtensionLinux(extension_csv, version, pipe) { const extensions = await utils.extensionArray(extension_csv); let add_script = '\n'; - let remove_script = '\n'; + let remove_script = ''; await utils.asyncForEach(extensions, async function (extension) { const version_extension = version + extension; const [ext_name, ext_version] = extension.split('-'); diff --git a/package-lock.json b/package-lock.json index 344f6a9c..a3ea5e27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "setup-php", - "version": "2.2.1", + "version": "2.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -428,13 +428,14 @@ } }, "@istanbuljs/load-nyc-config": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz", - "integrity": "sha512-ZR0rq/f/E4f4XcgnDvtMWXCUJpi8eO0rssVhmztsZqLIEFA9UUP9zmpE0VxlM+kv/E1ul2I876Fwil2ayptDVg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", "dev": true, "requires": { "camelcase": "^5.3.1", "find-up": "^4.1.0", + "get-package-type": "^0.1.0", "js-yaml": "^3.13.1", "resolve-from": "^5.0.0" }, @@ -891,9 +892,9 @@ } }, "@sinonjs/commons": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.2.tgz", - "integrity": "sha512-+DUO6pnp3udV/v2VfUWgaY5BIE1IfT7lLfeDzPVeMT1XKkaAp9LgSI9x5RtrFQoZ9Oi0PgXQQHPaoKu7dCjVxw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.0.tgz", + "integrity": "sha512-wEj54PfsZ5jGSwMX68G8ZXFawcSglQSXqCftWX3ec8MDUzQdHgcKvw97awHbY0efQEL5iKUOAmmVtoYgmrSG4Q==", "dev": true, "requires": { "type-detect": "4.0.8" @@ -996,9 +997,9 @@ } }, "@types/jest": { - "version": "25.2.2", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.2.2.tgz", - "integrity": "sha512-aRctFbG8Pb7DSLzUt/fEtL3q/GKb9mretFuYhRub2J0q6NhzBYbx9HTQzHrWgBNIxYOlxGNVe6Z54cpbUt+Few==", + "version": "25.2.3", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.2.3.tgz", + "integrity": "sha512-JXc1nK/tXHiDhV55dvfzqtmP4S3sy3T3ouV2tkViZgxY/zeUkcpQcQPGRlgF4KmWzWW5oiWYSZwtCB+2RsE4Fw==", "dev": true, "requires": { "jest-diff": "^25.2.1", @@ -1012,9 +1013,9 @@ "dev": true }, "@types/node": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.1.tgz", - "integrity": "sha512-FAYBGwC+W6F9+huFIDtn43cpy7+SzG+atzRiTfdp3inUKL2hXnd4rG8hylJLIh4+hqrQy1P17kvJByE/z825hA==", + "version": "14.0.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.5.tgz", + "integrity": "sha512-90hiq6/VqtQgX8Sp0EzeIsv3r+ellbGj4URKj5j30tLlZvRUpnAe9YbYnjl3pJM93GyXU0tghHhvXHq+5rnCKA==", "dev": true }, "@types/normalize-package-data": { @@ -1030,9 +1031,9 @@ "dev": true }, "@types/prettier": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.0.0.tgz", - "integrity": "sha512-/rM+sWiuOZ5dvuVzV37sUuklsbg+JPOP8d+nNFlo2ZtfpzPiPvh1/gc8liWOLBqe+sR+ZM7guPaIcTt6UZTo7Q==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.0.1.tgz", + "integrity": "sha512-boy4xPNEtiw6N3abRhBi/e7hNvy3Tt8E9ZRAQrwAGzoCGZS/1wjo9KY7JHhnfnEsG5wSjDbymCozUM9a3ea7OQ==", "dev": true }, "@types/stack-utils": { @@ -1057,45 +1058,46 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz", - "integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.0.0.tgz", + "integrity": "sha512-lcZ0M6jD4cqGccYOERKdMtg+VWpoq3NSnWVxpc/AwAy0zhkUYVioOUZmfNqiNH8/eBNGhCn6HXd6mKIGRgNc1Q==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "2.34.0", + "@typescript-eslint/experimental-utils": "3.0.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", + "semver": "^7.3.2", "tsutils": "^3.17.1" } }, "@typescript-eslint/experimental-utils": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", - "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.0.0.tgz", + "integrity": "sha512-BN0vmr9N79M9s2ctITtChRuP1+Dls0x/wlg0RXW1yQ7WJKPurg6X3Xirv61J2sjPif4F8SLsFMs5Nzte0WYoTQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.34.0", + "@typescript-eslint/typescript-estree": "3.0.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" } }, "@typescript-eslint/parser": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz", - "integrity": "sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.0.0.tgz", + "integrity": "sha512-8RRCA9KLxoFNO0mQlrLZA0reGPd/MsobxZS/yPFj+0/XgMdS8+mO8mF3BDj2ZYQj03rkayhSJtF1HAohQ3iylw==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.34.0", - "@typescript-eslint/typescript-estree": "2.34.0", + "@typescript-eslint/experimental-utils": "3.0.0", + "@typescript-eslint/typescript-estree": "3.0.0", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", - "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.0.0.tgz", + "integrity": "sha512-nevQvHyNghsfLrrByzVIH4ZG3NROgJ8LZlfh3ddwPPH4CH7W4GAiSx5qu+xHuX5pWsq6q/eqMc1io840ZhAnUg==", "dev": true, "requires": { "debug": "^4.1.1", @@ -2253,6 +2255,35 @@ "dev": true, "requires": { "@typescript-eslint/experimental-utils": "^2.5.0" + }, + "dependencies": { + "@typescript-eslint/experimental-utils": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", + "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.34.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", + "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + } } }, "eslint-plugin-prettier": { @@ -2794,6 +2825,12 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, "get-stdin": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", @@ -6755,9 +6792,9 @@ } }, "typescript": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz", - "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==", + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", + "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==", "dev": true }, "union-value": { diff --git a/package.json b/package.json index 448b000a..3c3ba4d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setup-php", - "version": "2.2.1", + "version": "2.2.2", "private": false, "description": "Setup PHP for use with GitHub Actions", "main": "dist/index.js", @@ -30,10 +30,10 @@ "fs": "0.0.1-security" }, "devDependencies": { - "@types/jest": "^25.2.2", - "@types/node": "^14.0.1", - "@typescript-eslint/eslint-plugin": "^2.34.0", - "@typescript-eslint/parser": "^2.34.0", + "@types/jest": "^25.2.3", + "@types/node": "^14.0.5", + "@typescript-eslint/eslint-plugin": "^3.0.0", + "@typescript-eslint/parser": "^3.0.0", "@zeit/ncc": "^0.22.2", "eslint": "^7.0.0", "eslint-config-prettier": "^6.11.0", @@ -45,7 +45,7 @@ "jest-circus": "^26.0.1", "prettier": "^2.0.5", "ts-jest": "^26.0.0", - "typescript": "^3.9.2" + "typescript": "^3.9.3" }, "husky": { "skipCI": true, diff --git a/src/extensions.ts b/src/extensions.ts index e0af6bef..1381cb79 100644 --- a/src/extensions.ts +++ b/src/extensions.ts @@ -15,7 +15,7 @@ export async function addExtensionDarwin( ): Promise { const extensions: Array = await utils.extensionArray(extension_csv); let add_script = '\n'; - let remove_script = '\n'; + let remove_script = ''; await utils.asyncForEach(extensions, async function (extension: string) { const version_extension: string = version + extension; const [ext_name, ext_version]: string[] = extension.split('-'); @@ -127,7 +127,7 @@ export async function addExtensionWindows( ): Promise { const extensions: Array = await utils.extensionArray(extension_csv); let add_script = '\n'; - let remove_script = '\n'; + let remove_script = ''; await utils.asyncForEach(extensions, async function (extension: string) { const [ext_name, ext_version]: string[] = extension.split('-'); const version_extension: string = version + extension; @@ -219,7 +219,7 @@ export async function addExtensionLinux( ): Promise { const extensions: Array = await utils.extensionArray(extension_csv); let add_script = '\n'; - let remove_script = '\n'; + let remove_script = ''; await utils.asyncForEach(extensions, async function (extension: string) { const version_extension: string = version + extension; const [ext_name, ext_version]: string[] = extension.split('-'); diff --git a/src/scripts/darwin.sh b/src/scripts/darwin.sh index 451ba1b6..3cae05a0 100644 --- a/src/scripts/darwin.sh +++ b/src/scripts/darwin.sh @@ -118,6 +118,9 @@ add_tool() { if [ -n "$COMPOSER_TOKEN" ]; then composer -q global config github-oauth.github.com "$COMPOSER_TOKEN" fi + elif [ "$tool" = "phan" ]; then + add_extension fileinfo "sudo pecl install -f fileinfo" extension >/dev/null 2>&1 + add_extension ast "sudo pecl install -f ast" extension >/dev/null 2>&1 elif [ "$tool" = "phive" ]; then add_extension curl "sudo pecl install -f curl" extension >/dev/null 2>&1 add_extension mbstring "sudo pecl install -f mbstring" extension >/dev/null 2>&1 diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index bcc8dfe7..af177f2d 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -219,6 +219,9 @@ add_tool() { fi elif [ "$tool" = "cs2pr" ]; then sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path" + elif [ "$tool" = "phan" ]; then + add_extension fileinfo "$apt_install php$version-fileinfo" extension >/dev/null 2>&1 + add_extension ast "$apt_install php-ast" extension >/dev/null 2>&1 elif [ "$tool" = "phive" ]; then add_extension curl "$apt_install php$version-curl" extension >/dev/null 2>&1 add_extension mbstring "$apt_install php$version-mbstring" extension >/dev/null 2>&1 diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 18791125..1964589a 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -165,7 +165,10 @@ Function Add-Tool() { Add-Content -Path $current_profile -Value "New-Alias $tool $php_dir\$tool.bat" >$null 2>&1 } catch { } } - if($tool -eq "phive") { + if($tool -eq "phan") { + Add-Extension fileinfo >$null 2>&1 + Add-Extension ast >$null 2>&1 + } elseif($tool -eq "phive") { Add-Extension xml >$null 2>&1 } elseif($tool -eq "cs2pr") { (Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr diff --git a/src/tools.ts b/src/tools.ts index 65a2c311..828f85cc 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -463,6 +463,10 @@ export async function addTools( url = github + 'squizlabs/PHP_CodeSniffer/' + uri; script += await addArchive(tool, version, url, os_version); break; + case 'phan': + url = github + 'phan/phan/' + uri; + script += await addArchive(tool, version, url, os_version); + break; case 'phive': script += await addPhive(version, os_version); break;