X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fprocess%2FProcessBuilder.php;h=9ad3924666fd0229e57ca33f5a6819c2012b1e08;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=54877a8282813c8f2595e564cc55ff20d799c660;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/process/ProcessBuilder.php b/vendor/symfony/process/ProcessBuilder.php index 54877a828..9ad392466 100644 --- a/vendor/symfony/process/ProcessBuilder.php +++ b/vendor/symfony/process/ProcessBuilder.php @@ -11,13 +11,15 @@ namespace Symfony\Component\Process; +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the Process class instead.', ProcessBuilder::class), E_USER_DEPRECATED); + use Symfony\Component\Process\Exception\InvalidArgumentException; use Symfony\Component\Process\Exception\LogicException; /** - * Process builder. - * * @author Kris Wallsmith + * + * @deprecated since version 3.4, to be removed in 4.0. Use the Process class instead. */ class ProcessBuilder { @@ -26,14 +28,12 @@ class ProcessBuilder private $env = array(); private $input; private $timeout = 60; - private $options = array(); + private $options; private $inheritEnv = true; private $prefix = array(); private $outputDisabled = false; /** - * Constructor. - * * @param string[] $arguments An array of arguments */ public function __construct(array $arguments = array()) @@ -78,7 +78,7 @@ class ProcessBuilder */ public function setPrefix($prefix) { - $this->prefix = is_array($prefix) ? $prefix : array($prefix); + $this->prefix = \is_array($prefix) ? $prefix : array($prefix); return $this; } @@ -103,7 +103,7 @@ class ProcessBuilder /** * Sets the working directory. * - * @param null|string $cwd The working directory + * @param string|null $cwd The working directory * * @return $this */ @@ -135,7 +135,7 @@ class ProcessBuilder * defined environment variable. * * @param string $name The variable name - * @param null|string $value The variable value + * @param string|null $value The variable value * * @return $this */ @@ -167,13 +167,11 @@ class ProcessBuilder /** * Sets the input of the process. * - * @param mixed $input The input as a string + * @param resource|string|int|float|bool|\Traversable|null $input The input content * * @return $this * * @throws InvalidArgumentException In case the argument is invalid - * - * Passing an object as an input is deprecated since version 2.5 and will be removed in 3.0. */ public function setInput($input) { @@ -260,24 +258,19 @@ class ProcessBuilder */ public function getProcess() { - if (0 === count($this->prefix) && 0 === count($this->arguments)) { + if (0 === \count($this->prefix) && 0 === \count($this->arguments)) { throw new LogicException('You must add() command arguments before calling getProcess().'); } - $options = $this->options; - $arguments = array_merge($this->prefix, $this->arguments); - $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments)); + $process = new Process($arguments, $this->cwd, $this->env, $this->input, $this->timeout, $this->options); + // to preserve the BC with symfony <3.3, we convert the array structure + // to a string structure to avoid the prefixing with the exec command + $process->setCommandLine($process->getCommandLine()); if ($this->inheritEnv) { - // include $_ENV for BC purposes - $env = array_replace($_ENV, $_SERVER, $this->env); - } else { - $env = $this->env; + $process->inheritEnvironmentVariables(); } - - $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options); - if ($this->outputDisabled) { $process->disableOutput(); }