From 3e4382c7c60ab2a41a81e97c5a1d7247fa8a4b15 Mon Sep 17 00:00:00 2001 From: Kyle Taylor Date: Thu, 28 Apr 2022 16:07:59 -0700 Subject: [PATCH] Fix Process.php expected type symfony/process in 3.x and below expects a string, but in 4.x and up expects an array. --- README.md | 2 +- composer.json | 2 +- src/Installer/NodeInstaller.php | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c029bbe..d05f1d6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ PHP projects mostly are Web-Applications. Many Web-Applications also need a fron modern Web-Development there often a whole build-chain connected to the frontend, so you can compile e.g. your scss, build your JavaScript with webpack and optimize your images. -This plugin provides a way to automatically download and installthe right version of node.js, npm and yarn. The binaries +This plugin provides a way to automatically download and install the right version of node.js, npm and yarn. The binaries are linked to the bin-directory specified in your composer.json. After that your can use node, npm and yarn in your composer-scripts. diff --git a/composer.json b/composer.json index 8ccc6c0..ea39cfb 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "php": ">=7.1", "composer/composer": "^1.4 || ^2.0", "composer-plugin-api": "^1.0 || ^2.0", - "symfony/process": "^2.7 || >=3.0", + "symfony/process": "~4 || ~5 || ~6", "symfony/filesystem": ">=2.7" }, "extra": { diff --git a/src/Installer/NodeInstaller.php b/src/Installer/NodeInstaller.php index e95478a..1c1b9ce 100644 --- a/src/Installer/NodeInstaller.php +++ b/src/Installer/NodeInstaller.php @@ -79,9 +79,10 @@ public function install($version) */ public function isInstalled() { - $nodeExecutable = $this->context->getBinDir() . DIRECTORY_SEPARATOR . 'node'; - $process = new Process("$nodeExecutable --version"); + $process = new Process(["node --version"], $this->context->getBinDir()); + $process->setIdleTimeout(null); + $process->setTimeout(null); $process->run(); if ($process->isSuccessful()) {